Can we call methods of base class using the constructor of the derived class?

Lê Như Ý

New member
Can we call methods of base class using the constructor of the derived class?
A. Yes, always
B. Yes, but not always
C. No, never
D. No, but we can call in some cases
 
Answer: a
Explanation: If the function is defined in the base class, it can always be called from the constructor of its derived class. Since the constructors are not private, they can be accessed in derived class even if those are protected.
 

Tìm kiếm

Back
Top