Which among the following is true for constructors overloading?

Which among the following is true for constructors overloading?
A. Constructors can’t be overloaded
B. Constructors can be overloaded using different signatures
C. Constructors can be overloaded with same signatures
D. Constructors can be overloaded with different return types
 
Answer: b
Explanation: The constructors can be overloaded only if the definitions have different signatures. Constructors doesn’t have any return type so can’t be overloaded using return type. If constructors have same signature then it will produce a compile time error.
 

Tìm kiếm

Back
Top