1.

If programmer have defined parameterized constructor only, then __________________(a) Default constructor will not be created by the compiler implicitly(b) Default constructor will be created by the compiler implicitly(c) Default constructor will not be created but called at runtime(d) Compile time errorI had been asked this question during an interview for a job.My question is based upon Overloading Constructors topic in section Constructors and Destructors of Object Oriented Programming

Answer»

Right choice is (a) Default CONSTRUCTOR will not be CREATED by the compiler implicitly

To explain I would SAY: When the PROGRAMMER doesn’t specify any default constructor and only defines some PARAMETERIZED constructor. The compiler doesn’t provide any default constructor implicitly. This is because it is assumed that the programmer will create the objects only with constructors.



Discussion

No Comment Found

Related InterviewSolutions