INHERITANCE IN C++ (13)

Give the following class Book answer the questions (i) adn (iv) that follows:

class Book
{
char Title[20];
char Author[20];
int No_of_Pages;
public:
void read();
void show();
};
class TextBook:private Book
{
int No_of_Chapters, No_of_Assigments;
protected:
int standard:
public:
void redtextbox();
void readtextbook();
};
class PhysicsBook:public TextBook
{
char Topic[20];
public:
void readphysicbook();
void showphysicsbook();
};

(i) Which type of Inheritance out of the following is illustrated in the above example?
I. Single Level Inheritance
II. Multi Level Inheritance
III. Multiple Inheritance
(ii) Name the data memebers, which can be acccesed by an object of class TextBook.
(iii) Name the member functions, which can be accessed by an object of class PhysicsBook.
(iv) What will be the size of an object (in bytes) of class PhysicsBook?



No comments

Post your comments

Powered by Blogger.