Results 1 to 7 of 7

Thread: What's going on here?

  1. #1

    What's going on here?

    http://www.java2s.com/Tutorial/CShar...onstructor.htm

    In the 2nd constructor, this is used. Can anyone please explain what's going on there?

    Thanks!

  2. #2
    602
    posts
    Backend Specialist
    Function Overloading. You can create an instance of the class with either one parameter, or two since it is being defined there. In their example they used two, but they could have used one and not received an error. Search for function overloading and it should explain much better than me.

  3. #3
    Sorry, I wasn't very clear. I meant what's going on here:
    Code:
    public ComplexNumber( double real ):this( real, 0 )
    What is ": this" doing after the function definition?

    Thanks!

  4. #4
    TheCanadian's Avatar
    10,302
    posts
    Noo doot aboot it, eh?
    Last edited by TheCanadian; August 24th, 2008 at 01:00 PM.
    Proud Montanadian
    We tolerate living and breathing. And niches.

    Name Brand Watches

    Maybe getTimer() or TweenMax is the answer to your problem . . .

  5. #5
    Oh, so it was what skOOb said. Thanks guys!

  6. #6
    TheCanadian's Avatar
    10,302
    posts
    Noo doot aboot it, eh?
    No problem, I was just googling stuff because I was curious as well - I don't even code C sharp!
    Proud Montanadian
    We tolerate living and breathing. And niches.

    Name Brand Watches

    Maybe getTimer() or TweenMax is the answer to your problem . . .

  7. #7
    Oh parameterised constructor its not exactly function overloading its simply is parameterised constructor through which static polymorphism is implemented.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012