Interview Question
Qus: What is a Constructor?
A constructor is a special method of the class which gets automatically invoked whenever an instance of the class is created. Like methods, a constructor also contains the collection of instructions that are executed at the time of Object creation. It is used to assign initial values to the data members of the same class. It has the same name as the class name in which it resides.
Answers (2)