Advertisement Remove all ads

Which Type of Inheritance Out of the Following Is Illustrated in the Above Example and Write the Name of All the Member Which Are Directly Accessible by the Member Function View() of Class Schedule. and Write the Names of All the Members, Which Are Directly Accessible by the Object S of Class Schedule Declared in the Main() Function. - Computer Science (C++)

Answer the question (i)  to (iv) based on the following:

class Teacher
{
   int TCode;
protected:
      char Name[20];
public:
      Teacher();
      void Enter() ; void Show();
};

class Course
(
   int ID;
protected:
      Char Title[30];
public:
      Course();
      void Initiate();
      void Display();
};

class Schedule : public Course, private Teacher
{
    int DD, MM, YYYY;
public:
    Schedule();
    void Start();
    void View();
};

void main()
{
   Schedule S;
}

1) Which type of Inheritance out of the following is illustrated in the above example?

2) Write the name of all the member which are directly accessible by the member function View() of Class Schedule.

3) Write the names of all the members, which are directly accessible by the object S of Class Schedule declared in the main() function.

4) What will be the order of execution of the constructors, when the object S of the Class Schedule Schedule is declared inside the main() function?

Advertisement Remove all ads

Solution

1) Multiple Inheritance

2) DD,MM,YYYY, Title[30], Name[20]

3) Start (), View(), Initiate(), Display(), Enter(), Show()

4) Schedule (), Course(), Teacher()

Concept: Inheritance in C++
  Is there an error in this question or solution?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×