Home »
MCQs »
C++ MCQs
Which of the following statement is correct about constructors in C++?
185. Which of the following statement is correct about constructors in C++?
- A constructor is used to destroy an object.
- Constructor is used to initializing data members when an object gets created.
- Constructor is used to call the private function from outside the class.
- None of the above
Answer: B) Constructor is used to initializing data members when an object gets created.
Explanation:
Constructor is a special type of member function that automatically calls when an object gets created. It is used to initialize the data members of the class.