Advertisement
Guest User

PO_7

a guest
Nov 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. class Pracownik
  8. {
  9.     static int id;
  10.     int IID;
  11.     const int licznik = 0;
  12.     static const int stawka = 10 ;
  13. public:
  14.     string imie;
  15.     string nazwisko;
  16.     Pracownik();
  17.     Pracownik(string, string);
  18.     Pracownik(Pracownik &prcwnk);
  19.     ~Pracownik();
  20. };
  21.  
  22. Pracownik::Pracownik() :
  23.     imie("Jan"),
  24.     nazwisko("Kowalski")
  25. {
  26. }
  27.  
  28. Pracownik::Pracownik(string imie, string nazwisko)
  29. {
  30.     cin >> imie;
  31.     cin >> nazwisko;
  32. }
  33.  
  34. Pracownik::Pracownik(Pracownik &prcwnk)
  35. {
  36.     imie = prcwnk.imie;
  37.     nazwisko = prcwnk.nazwisko;
  38. }
  39.  
  40. Pracownik::~Pracownik()
  41. {
  42. }
  43.  
  44. class Informatyk
  45.     : public Pracownik
  46. {
  47. public:
  48.     Informatyk();
  49.     Informatyk(Pracownik &prcwnk);
  50.     ~Informatyk();
  51. private:
  52.     const double przelicznik = 3.5;
  53. };
  54.  
  55. Informatyk::Informatyk()
  56. {
  57.     imie = "Andrzej";
  58.     nazwisko = "Duda";
  59. }
  60.  
  61. Informatyk::Informatyk(Pracownik &prcwnk)
  62. {
  63.     imie = prcwnk.imie;
  64.     nazwisko = prcwnk.nazwisko;
  65. }
  66.  
  67. Informatyk::~Informatyk()
  68. {
  69. }
  70.  
  71. class Kierownik
  72.     : public Pracownik
  73. {
  74. public:
  75.     Kierownik();
  76.     ~Kierownik();
  77.     const double przelicznik = 5;
  78. private:
  79.  
  80. };
  81.  
  82. Kierownik::Kierownik()
  83. {
  84.     string imie, nazwsiko;
  85.     cout << endl << "Podaj imie: ";
  86.     cin >> imie;
  87.     cout << endl << "Podaj nazwisko: ";
  88.     cin >> nazwsiko;
  89.     Pracownik kierownik(imie, nazwsiko);
  90. }
  91.  
  92. Kierownik::~Kierownik()
  93. {
  94. }
  95.  
  96.  
  97. int main()
  98. {
  99.     Pracownik domyslny, sparametryzowany("Janusz", "Nowak");
  100.     Informatyk inf1, inf2 = inf1;
  101.     Kierownik kier1();
  102.  
  103.  
  104.     system("pause");
  105.     return 0;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement