Sail E0 Webinar
Question

What is the main purpose of the constructor?


Options:
A .  Begin the execution of the class
B .  Include the macros for the program
C .  Establish the class invariant
D .  None of the mentioned
Answer: Option C

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.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers