Technical Discussion :: C++
Home > Technical Interview Q&A > C++ > Discussion
13 / 187
What is constructor? What is the return type of it?
Answer:
A constructor is a special member function whose task is to initialize the objects of its class. It is special because its name is the same as the class name. The constructor is invoked whenever an object of its associatied class is created.
It is called constructor because it construct the values of data members of the class.
Asked In ::
Shashi
23 Feb, 2019 5:07 AM
A constructor is a special member function whose task is to initialize the objects of its class. It is special because its name is the same as the class name. The constructor is invoked whenever an object of its associatied class is created.
It is called constructor because it construct the values of data members of the class.
It is called constructor because it construct the values of data members of the class.