Advertisement
Guest User

Untitled

a guest
May 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5.  
  6. class Scientist
  7. {
  8. private:
  9. int ID;
  10. double GPA;
  11. public:
  12. void GetId()
  13. {
  14. cin >> ID;
  15. cin >> GPA;
  16. }
  17.  
  18. virtual void MajorOrMinor() = 0;
  19. virtual void MajorOrMinor(char*str,char*str1) = 0;
  20. };
  21.  
  22. class Mathematician : public Scientist
  23. {
  24. public:
  25. void MajorOrMinor(int a)
  26. {
  27. cout << " Default Override " << endl;
  28. }
  29. void MajorOrMinor(char* str,char*str1)
  30. {
  31. cout << str << endl;
  32. cout << str1 << endl;
  33. }
  34. };
  35.  
  36. class Physicist : public Scientist
  37. {
  38. public:
  39. void MajorOrMinor()
  40. {
  41. cout << " Default Override " << endl;
  42. }
  43. void MajorOrMinor(char* str,char*str1)
  44. {
  45. cout << str << endl;
  46. cout << str1 << endl;
  47. }
  48. };
  49.  
  50.  
  51. int main()
  52. {
  53.  
  54. Mathematician Tornike;
  55. Physicist Nika;
  56.  
  57. cout << "Tornike Enter your ID and GPA " << endl;
  58. Tornike.GetId();
  59. cout << "Nika Enter your ID and GPA " << endl;
  60. Nika.GetId();
  61.  
  62.  
  63. Tornike.MajorOrMinor(2);
  64. Nika.MajorOrMinor();
  65.  
  66.  
  67.  
  68.  
  69.  
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement