Answer to Question #251732 in C++ for Gulli

Question #251732
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


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