InterviewSolution
Saved Bookmarks
| 1. |
When is the memory allocated for an object?(a) At declaration of object(b) At compile time(c) When object constructor is called(d) When object is initialized to another objectThe question was posed to me in an online interview.The origin of the question is Overloading Member Functions topic in portion Member Functions & its Types of Object Oriented Programming |
|
Answer» CORRECT CHOICE is (c) When OBJECT constructor is called To explain: The object memory allocation takes place when the object constructor is called. Declaration of an object doesn’t mean that memory is allocated for its members. If object is initialized with ANOTHER object, it may just get a reference to the previously created object. |
|