1.

Which among the following is true?(a) Default constructor can’t be defined by the programmer(b) Default parameters constructor isn’t equivalent to the default constructor(c) Default constructor can be called explicitly(d) Default constructor is and always called implicitly onlyThis question was posed to me during an interview.I'd like to ask this question from Types of Constructors topic in section Constructors and Destructors of Object Oriented Programming

Answer»

Right answer is (c) Default constructor can be CALLED explicitly

Easiest explanation - Default constructors can be called explicitly ANYTIME. They are specifically used to ALLOCATE memory space for the object in memory, in general. It is not necessary that these should ALWAYS be called implicitly.



Discussion

No Comment Found

Related InterviewSolutions