Which statement is correct? A constructor
-
A
Contains declarations of functions and macros
-
B
Means bundling data and methods together and restricting direct access to the data
-
C
Makes a program run but produce incorrect output
-
D
Is a special method called when an object is created
Correct answer
Correct answer
D. Is a special method called when an object is created
Explanation
A constructor is a special method called when an object is created.
Doubts & discussion
Not sure why the answer is D? Ask here and get an explanation.
Ask a doubt about this MCQ