Answer to Question #234713 in C++ for SOM

Question #234713

Consider the class hierarchy shown below.


class A

{  int a;

protected:

int b;

public:

int c;   };

class B: protected A

{  };

Class C: public B

{   };


Which data members of class A are accessible

- in class B       

-in class C       

-in main function 

Justify your answer.



1
Expert's answer
2021-09-10T23:52:05-0400

c and b are accessible in class B since b is inherited by class B

only c is accessible in class C since c is public

only c is accessible in the main class because it is public and can be accessed from anywhere.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS