Advertisements
Advertisements
Question
A constructor is used to initialize the data members of a class.
Options
True
False
MCQ
True or False
Solution
This statement is True.
Explanation:
A constructor is a class-specific member function used automatically when an object is created. Its principal purpose is to set default or specified values for the class's data members.
shaalaa.com
Is there an error in this question or solution?