Overloaded Constructor?

csharp Viet Nam
  • 9 years ago

    Please help clear up a bit of confusion.

    Is a Overloaded Constructor only when you have more then one constructor? or when you pass parameters?

    Thanks in advance!

  • 9 years ago

    [quote user="mail2uma07"]

    Overloading is similar to that of Overriding. But Overriding will be for a method while Overloading will be for a constructor.

    [/quote] Everything up to here was great, then it fell apart.  Overloading and overriding have nothing whatsoever to do with each other.  Any method, including constructors, and any property can be overloaded.  Any method or property declared virtual can be overridden in a derived class.

    Overloading means providing two or more signatures for the same member name.  Overriding means replacing the implementation of a member in a base class with a new implementation in a derived class.

    A member could be overridden or overloaded or both or neither.  If a member is overloaded you might declare one or more overloads virtual, meaning any or all of those overloads could be overridden in a derived class.
     

  • 9 years ago

    mail2uma07

    Thank you, I am learning this on my own, and my time is very limited. I don't have any local resources that I can easily talk to, to help me explain things.  The part about Overriding, thanks, I will get to that in my studies and any little bit of knowledge is very helpful, expecially when it makes sense!!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan