Qus:    What is a Constructor?
Nov 19, 2020 10:53 2 Answers Views: 612 SHIVA

 



 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.

Prev Next
Answers (2)
SWEETY Nov 20, 2020 11:03
Answer:   It’s a method which have same name as class or struct name. It’s called automatically at the time of object creation.

PARTH Nov 21, 2020 01:57
Answer:   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.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect