Advertisements
Advertisements
Question
A constructor gets activated when ______.
Options
it is invoked
an object of the class is created
the program is compiled
never
MCQ
Fill in the Blanks
Advertisements
Solution
A constructor gets activated when an object of the class is created.
Explanation:
A constructor is a special method of a class that is automatically called when an object is created. It is mainly used to initialize the data members of the object.
shaalaa.com
Is there an error in this question or solution?
