Suppose a program has the following class declarationDeclara

Suppose a program has the following class declaration//Declaration of checkpoint class. class checkpoint private int a; protected int b int c void set A void set C Answer the following questions regarding the class: Suppose another class, Quiz, is derived from the checkpoint class as: class Quiz: protected checkpoint indicates whether each member of the class is private protected public or inaccessible. set A set B set C Suppose the Quiz class, derived from the checkpoint class, is declared as class Quiz: public checkpoint indicates whether each member of the checkpoint class is private, protected public or inaccessible: set A set B set C

Solution

Please follow this concept to solve the question :

When base class is protected ,public and protected methods and variables will become protected.So for part (a) a will be private , else will all be protected (b,c ,setA,setB,setC)

When base class is public than public members will be public ,protected member will be protected and private will be private. So a will be private and inaccessible, b ,c and setA will remain protected and setB and setC will remain public.

 Suppose a program has the following class declaration//Declaration of checkpoint class. class checkpoint private int a; protected int b int c void set A void s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site