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.

Categorized in:

C++

Tagged in:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Share Article:

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock