If the constructors are overloaded by using the default arguments, which problem may arise?

If the constructors are overloaded by using the default arguments, which problem may arise?
A. The constructors might have all the same arguments except the default arguments
B. The constructors might have same return type
C. The constructors might have same number of arguments
D. The constructors can’t be overloaded with respect to default arguments
 
Answer: a
Explanation: The constructors having same arguments except the default arguments can give rise to errors. If only the mandatory arguments are passed, it will create ambiguity in calling the correct constructor. Hence the mandatory arguments must be different.
 

Tìm kiếm

Back
Top