What is the syntax for calling an overloaded constructor from within a constructor?

You may have noticed that this() and constructor-name() do not compile.
The syntax for calling another constructor is as follows:

class A
{
A (int i) { }
}

class B : A
{
B() : base (10) // call base constructor A(10)
{ }

B(int i) : this() // call B()
{ }

public static void Main() {}
}

Leave a Reply

Your email address will not be published. Required fields are marked *