In c++ how are protected members of a base class accessed in derived class when inherited privately ?
A. Privately
B. Publicly
C. Protectedly
D. Not Inherited
Answer : A. Privately
Explanation:
- Derived classes can access protected and public members of it’s base class, and the derived class can not access the private members of it’s base class.
- The private members are inherited for the following reason :
- The base class can define a protected or public function that modifies the base class’s private member.