Can a class have more than one function with all the default arguments?

Thê Hy

New member
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, never
 
Answer: d
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.
 

Tìm kiếm

Back
Top