1.

Can constructors be overloaded in derived class?(a) Yes, always(b) Yes, if derived class has no constructor(c) No, programmer can’t do it(d) No, neverThis question was addressed to me during an interview for a job.The query is from Overloading Constructors topic in division Constructors and Destructors of Object Oriented Programming

Answer»

The correct OPTION is (d) No, never

Easy explanation - The constructor must be having the same name as that of a class. Hence a constructor of ONE class can’t even be DEFINED in ANOTHER class. Since the constructors can’t be defined in derived class, it can’t be overloaded too, in derived class.



Discussion

No Comment Found

Related InterviewSolutions