1.

What is the main purpose of the constructor?(a) Begin the execution of class(b) Include the macros for the program(c) Establish the class invariant(d) Terminate the program

Answer» Right answer is (c) Establish the class invariant

The best I can explain: The purpose of a constructor is to establish the class invariant. To do that, it often needs to acquire system resources or in general perform an operation that may fail.


Discussion

No Comment Found

Related InterviewSolutions