Advertisements
Advertisements
Question
Consider the following c++ code and answer the question?
class Personal
{ int Class,Rno;
char Section;
protected:
char Name[20];
public:
personal();
void pentry();
void Pdisplay(); };
class Marks:private Personal
{ float M{5};
protected:
char Grade[5];
public: Marks();
void Mentry();
void Mdisplay(); };
class Result:public Marks
{
float Total,Agg;
public:
char FinalGrade, Commence[20];
Result();
void Rcalculate();
void Rdisplay();
};
Specify the visibility mode of base classes.
Solution
Private for the personal public for marks.
APPEARS IN
RELATED QUESTIONS
What is the difference between public and private visibility modes?
What is the difference between the members present in the private visibility mode and the members present in the public visibility mode?
Based on the following class declaration answer the question?
class vehicle
{ int wheels;
public:
void input_data(float,float);
void output_data();
protected:
int passenger;
};
class heavy_vehicle : protected vehicle {
int diesel_petrol;
protected:
int load;
public:
void read_data(float,float)
void write_data(); };
class bus: private heavy_vehicle {
char Ticket[20];
public:
void fetch_data(char);
void display_data(); };
The member function is inherited as public by Class Bus ______
Explain the different visibility modes through pictorial representation?