1.

Can a class have more than one function with all the default arguments?(a) Yes, always(b) Yes, if argument list is different(c) No, because constructors overloading doesn’t depend on argument list(d) No, neverThis question was addressed to me by my college professor while I was bunking the class.I'm obligated to ask this question of Constructors Overloading in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right option is (d) No, never

Best explanation: A single class can never have more than once CONSTRUCTOR with all the default arguments. This is because it will MAKE all those CONSTRUCTORS as a default constructor. And when an object is CREATED with zero arguments then it will CREATE ambiguity.



Discussion

No Comment Found

Related InterviewSolutions