Q:

What is a constructor in c++?

0

What is a constructor in c++?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

Class constructors in C++  are special member functions of a class and it initializes the object of a class. It is called by the compiler (automatically) whenever we create new objects of that class. The name of the constructor must be the same as the name of the class and it does not return anything.

You should remember that the constructor has a secret argument and this argument is “this pointer” (Address of the object for which it is being called).

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions and Answers(2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Is the default constructor exists in C++?... >>
<< Why is the size of an empty class not zero in C++?...