Can constructors be overloaded in derived class?

Nguyễn Trà

New member
Can constructors be overloaded in derived class?
A. Yes, always
B. Yes, if derived class has no constructor
C. No, programmer can’t do it
D. No, never
 
Answer: d
Explanation: The constructor must be having the same name as that of a class. Hence a constructor of one class can’t even be defined in another class. Since the constructors can’t be defined in derived class, it can’t be overloaded too, in derived class.
 

Tìm kiếm

Back
Top