Introduction

If you ask the question that can we call constructor from another constructor then I will say yes we can. Calling constructor from another constructor is known as constructor chaining. This can be done by the keyword this and base. Here we discuss on this keyword and will discuss base keyword in the article constructor with inheritance.

For Example

public class Class1
{
    public Class1(): this(10)
    { 
    
    }
    public Class1(int x)
    { 
    

    
    }

}

In this way constructor will call another constructor.

Note:-static constructor cannot be chained. And a public constructor can access a private constructor with the help of constructor chaining.

Email Address

For any query you can send mail at info@techaltum.com
Thanks