Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #include <iostream>
  2. #include "Lekcja1.h"
  3. using namespace std;
  4. class Zadanie {
  5. public:
  6. Zadanie(int chose);
  7. ~Zadanie();
  8. void Describe();
  9. private:
  10. int _chose;
  11. };
  12.  
  13. Zadanie::Zadanie(int chose) {//konstruktor
  14. this->_chose = chose;
  15. }
  16.  
  17. Zadanie::~Zadanie() {//destruktor
  18. }
  19. void Zadanie::Describe() {
  20. switch (_chose)
  21. {
  22. case 1:
  23. cout << "Huj" << endl;
  24. break;
  25. default:
  26. cout << "Nie ma takiego zadania!" << endl;
  27. break;
  28. }
  29. }
  30.  
  31. void wyswietlZadanie(Zadanie* objs) {
  32. objs->Describe();
  33. }
  34. class Lekcja {
  35. public:
  36. Lekcja(int chose);
  37. ~Lekcja();
  38. void Describe();
  39. private:
  40. int _chose;
  41. int numer;
  42. };
  43. Lekcja::Lekcja(int chose) {//konstruktor
  44. this->_chose = chose;
  45. }
  46.  
  47. Lekcja::~Lekcja() {//destruktor
  48. }
  49. void Lekcja::Describe() {
  50. switch (_chose)
  51. {
  52. case 1:
  53. {
  54. cout << "Wpisz numer Zadania od 1 do 5: " << endl;
  55. cin >> numer;
  56. Zadanie* obj = new Zadanie(numer);
  57. wyswietlZadanie(obj);
  58. delete obj;
  59. }
  60. break;
  61. default:
  62. cout << "Nie ma takiej lekcji!" << endl;
  63. break;
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement