Constructors in C# with Example and Types of Constructor

Posted By : Bipul Kumar Tiwari,

Types of Constructors


01. Default Constructor:

                      A constructor without having parameters or arguments it called Default constructor.

Default Constructor

02. Parameterized Constructor:

                      A constructor that have parameters is known as parameterized constructor. It is used to provide different values to the distinct object.

Parameterized Constructor

03. Copy constructor:

                      A parameterized constructor that contains a parameter of same class type is called as copy constructor.Copy constructor is use to initialize a new instance to the values of an existing instance.

copy Constructor

04. Static Constructor:


Static Constructor

Note : We created three object for example class. But static constructor are invoke only one time mince Static constructor will execute automatically whenever we create first instance of class.

05. Private Constructor:


Private Constructor


Related Articles

 

About the Author

author
Its me BIPUL who is logically minded creative at heart , a good communicator , a self taught full stack developer. I constantly focuses on my thinking , reading , collecting and creating my work in a order to enhance my skills.

I discover new dimensions for growing bussiness with a proven record in creating database and programming. I have a strong technical skills as well as strong interpersonal skills. Read more...
 

Browse By Category

Popular Articles