Protected & private access specifiers difference in inheritance - Inheritance

Q.  What is the difference between protected and private access specifiers in inheritance?
- Published on 17 Jul 15

a. private member is not inheritable and not accessible in derived class.
b. protected member is inheritable and also accessible in derived class.
c. Both are inheritable but private is accessible in the derived class.
d. Both are inheritable but protected is not accessible in the derived class.

ANSWER: protected member is inheritable and also accessible in derived class.
 

    Discussion

  • Brijesh   -Posted on 08 Oct 15
    Protected member is inheritable and also accessible in derived class but private member is not accessible in derived class.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)