A Constructor is a special method of a Class, which is used to initialize the members of the same class. Whenever an Object of a class is created , a Constructor is called by default.Constructor do not return values and always have the same name as the Class.
A Derived Class can not inherit the Constructor of its Base Class. All the Derived Classes have their own default Constructor.
When you intiantiate a Derived Class , first the Constructor of Base Class is called and then derived class Constructor is called.
The Constructor of Base Class is initializes the members of the Base Class before derived class constructor is executed.
Points to Remember :-
What is Destructor in C# ? Describe it in details.
A Destructor or finalizer is called when the Object is finally destroyed and the garbage is collected.
Points to Remember :-
About the Author
Sudheer Singh Chouhan is a Software Engineer having Expertise in Development Design and Architecting the
applications , Project Management , Designing Large Scale Databases in SQL Server since last 17 Years.
Skill Sets :- Microsoft .NET technologies like ASP.Net Core, Web API, LINQ, Web Forms, WinForms, SQL Server,
EntityFramework, Design Patterns, Solid Principles, Microservices, AWS Cloud.