Q1: Consider the following declarations and answer the question given below :
class Vehicle
{
private:
int wheels;
protected :
int passenger:
public :
void inputdata(int, int);
void outputdata();
};
class Heavyvehicle : protected Vehicle
{
int diesel_petrol;
protected :
int load;
public:
void readdata(int, int);
void writedata();
};
class Bus : private Heavyvehicle
{
char make[20];
public :
void fetchdata(char);
void displaydata();
};
(i) Name the base class and derived class of the class Heavyvehicle.
(ii) Name the data member(s) that can be accessed from function displaydata().
(iii) Name the data member's that can be accessed by an object of Bus class.
(iv) Is the member function outputdata() accessible to the objects of Heavyvehicle class.
1
Expert's answer
2021-10-15T05:25:32-0400
i) Base class - Vehicle
Derived class - Bus
ii) make, load
iii) only the member functions fetchdata() and displaydata()
iv) no, protected members are inaccessible outside the class
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment