Advertisement
sajid006

three

Mar 7th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. class Person
  5. {
  6. public:
  7. string name;
  8. int code;
  9. Person()
  10. {
  11. name = "";
  12. code = 0;
  13. }
  14. };
  15. class Account:public Person
  16. {
  17. public:
  18. int pay;
  19. Account()
  20. {
  21. pay = 0;
  22. }
  23. };
  24. class Admin:public Person
  25. {
  26. public:
  27. int experience;
  28. Admin()
  29. {
  30. experience = 0;
  31. }
  32. };
  33. class Master :public Account, public Admin
  34. {
  35. public:
  36. Master() {}
  37. Master(string name, int code, int pay, int experience)
  38. {
  39. Account::name = name;
  40. Account::code = code;
  41. Account::pay = pay;
  42. Admin::experience = experience;
  43. }
  44. void update(string name, int code, int pay, int experience)
  45. {
  46. Account::name = name;
  47. Account::code = code;
  48. Account::pay = pay;
  49. Admin::experience = experience;
  50. }
  51. void display()
  52. {
  53.  
  54. cout<<"Name:"<<Account::name << endl;
  55. cout<<"Code:"<<Account::code << endl;
  56. cout<<"Pay:"<<Account::pay << endl;
  57. cout<<"Admin:"<<Admin::experience << endl;
  58. }
  59. };
  60. int main()
  61. {
  62. Master m("Dipu", 1607012, 50000, 0);
  63. m.display();
  64. m.update("Dipu",1502118,34222,1);
  65. m.display();
  66. return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement