Which among the following is true?

Trương Duy

New member
Which among the following is true?
A. The constructors overloading can be done by using different names
B. The constructors overloading can be done by using different return types
C. The constructors can be overloaded by using only one argument
D. The constructors must have the same name as that of class
 
Answer: d
Explanation: The constructors must have the same name as that of the class name. This is mandatory because only the constructor functions doesn’t have any return type. Also, for overloading all the functions must have the same name.
 

Tìm kiếm

Back
Top