InterviewSolution
Saved Bookmarks
| 1. |
Which among the following helps to create a temporary instance?(a) Implicit call to a default constructor(b) Explicit call to a copy constructor(c) Implicit call to a parameterized constructor(d) Explicit call to a constructorThe question was posed to me in an interview.My enquiry is from Constructors in section Constructors and Destructors of Object Oriented Programming |
|
Answer» RIGHT ANSWER is (d) Explicit CALL to a constructor Explanation: Explicit call to a constructor can LET you create a temporary instance. This is because the temporary instances doesn’t have any name. Those are DELETED from memory as soon as their reference is removed. |
|