C# - Calling one constructor from another

In order to call one constructor from another constructor in C# programming language you can use below syntax:

class Plane
{
 Plane (){}
 Plane (int a) : this() {}
 Plane (int a, int b) : this(int a) {}
}

In above example constructor Plane (int a) invokes parameterless constructor Plane(). Constructor Plane(int a, int b) invoke two above constructors nested.

2 comments:

Unknown at: 19 January 2014 at 10:33 said...
This comment has been removed by the author.
happy at: 19 January 2014 at 10:34 said...

Quick and comperhensive explanation. Thanks.

Post a Comment

Powered by Blogger.

Sample Text

Sample Text

Sample text

Sample Text

Social Icons

Social Icons

Followers

Featured Posts