Answer to Question #269316 in C++ for Aashi

Question #269316

Implement following class hierarchy using multi level inheritance.



School




Department




Teacher




Data member's are as follows: School: School Name, Number of department Department: Department Name, Number of employee Teacher: Teacher Name, salary of the teacher.

1
Expert's answer
2021-11-21T04:57:47-0500
#include <iostream>
using namespace std;

class School {
    public:
      string schoolName;
      int DepartmentNumber;
     
};

class Department : public School {
    public:
          string DepartmentName;
          int employeeNumber;
          void display() {
          cout<<"The Name of the School is: ";
      }
};

class Teacher : public Department {
     public: 
         string TeacherName;
         float  TeacherSalary;
};

int main() {
    Teacher obj;
    obj.display();
    return 0;
}

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