InterviewSolution
Saved Bookmarks
| 1. |
#include#include#includeusing name spacestd;class publisher{char pname[15];char hoffice[15];char address[25];double turnover;protected:char phone[3][10];void register();public:publisher();∼ publisher);void enter data();void disp data(); };class branch{charbcity[15];char baddress[25];protected:intnoofemp;public:charbphone[2][10];branch();∼ branch();void have data();void give data();};class author: public branch, publisher{intaut_code;charaname[20];float income;public:author();~author();voidgetdata();voidputdata();};Answer the following questions based on the above given program:1. Which type of Inheritance is shown in the program?2. Specify the visibility mode of base classes.3. Give the sequence of Constructor/Destructor Invocation when object of class author is created.4. Name the base class(/es) and derived class (/es). |
|
Answer» 1. Multiple inheritance. 2. Private for publisher. Public for branch 3. branch(); // constructor of branch class publisher (); // constructor of publisher class author (); // constructor of author class ∼author (); // destructor of author class ∼publisher (); // destructor of publisher class ∼branch (); // destructor of branch class 4. Base class(/es): branch and publisher Derived class (/es): author. |
|