Constructor is a special method of a class, which is called automatically when the instance of a class is created. It is created with the same name as the class and initializes all class members, whenever you access the class. The main features of a constructor are as follows:
- Constructors do not have any return type
- Constructors are always public
- It is not mandatory to declare a constructor; it is invoked automatically by .NET Framework.
No comments:
Post a Comment