Advertisements
Advertisements
Question
Which constructor initialises data members with default values?
Options
Parameterized constructor
Non-parameterized constructor
Copy constructor
Default constructor
MCQ
Solution
Default constructor
Explanation:
A default constructor takes no parameters and sets the data members' default values (for example, 0 for numeric types, null for objects, and false for booleans). If a class does not have a constructor declared, the compiler will provide one by default.
shaalaa.com
Is there an error in this question or solution?