MasterGun

Untitled

Apr 25th, 2020
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using namespace std;
  2. class Human {
  3. int age;
  4. string name;
  5. public:
  6. Human(int age, string name) {
  7. this->age = age;
  8. this->name = name;
  9. }
  10. string getName() {
  11. return name;
  12. }
  13. int getAge() {
  14. return age;
  15. }
  16. };
  17. class Employee{
  18. string company;
  19. int salary;
  20. public:
  21. Employee(string com, int sal) {
  22. this->company = com;
  23. this->salary = sal;
  24. }
  25. string getComp() {
  26. return company;
  27. }
  28. int getSal() {
  29. return salary;
  30. }
  31. };
  32. class Teacher : public Human, public Employee{
  33. string subject;
  34. public:
  35. Teacher(string sub,int age, string name,string com,int sal) : Human(age,name),Employee(com,sal){
  36. this->subject = sub;
  37. }
  38. };
RAW Paste Data