Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include<string>
- using namespace std;
- class Person
- {
- protected:
- double Weight;
- double Height;
- string Gender;
- public:
- Person()
- {
- Weight=0.0;
- Height=0.0;
- Gender="Unknown";
- }
- Person(double w,double h,string g)
- {
- Weight=w;
- Height=h;
- Gender=g;
- }
- void setWeight(double w){Weight=w;}
- void setHeight(double h){Height=h;}
- void setGender(string g){Gender=g;}
- double getWeight(){return Weight;}
- double getHeight(){return Height;}
- string getGender(){return Gender;}
- };
- class Employee
- {
- protected:
- string Designation;
- int HoursPerDay;
- public:
- Employee()
- { Designation="";
- HoursPerDay=0;
- }
- Employee(string d,int hpd)
- {
- Designation=d;
- HoursPerDay=hpd;
- }
- void setDesignation(string d){Designation=d;}
- void setHoursPerDay(int hpd){HoursPerDay=hpd;}
- string getDesignation(){return Designation;}
- int getHoursPerDay(){return HoursPerDay;}
- };
- class Teacher:public Person,public Employee
- {
- protected:
- Person p1;
- Employee e1;
- public:
- void display()
- {
- cout<<"Gender of Teacher :: "<<getGender()<<endl;
- cout<<"Weight of Teacher :: "<<getWeight()<<endl;
- cout<<"Height of Teacher :: "<<getHeight()<<endl;
- }
- };
- int main()
- {
- Teacher t1;
- t1.display();
- return 0;
- }