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.
#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;
}
Comments
Leave a comment