Advertisement
Lempek

klasy.h

Dec 27th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. #ifndef KLASY_H
  2. #define KLASY_H
  3. #include <cstdlib>
  4. #include <iostream>
  5. #include <string>
  6. #include <ctype.h>
  7. #include <conio.h>
  8. #include <iomanip>
  9. #include <limits>
  10. using namespace std;
  11.  
  12. class Osoba {
  13. protected:
  14. string imie;
  15. string nazwisko;
  16. public:
  17. // Konstruktor domyślny
  18. Osoba();
  19. // Konstruktor z parametrami
  20. Osoba(string &imie, string &nazwisko);
  21. // Konstruktor kopiujący
  22. Osoba(const Osoba &osoba);
  23. // Destruktor
  24. virtual ~Osoba();
  25. //Funkcje do zapisywania i wczytywania danych z/do pliku oraz wyświetlania danych w konsoli
  26. virtual void wyswietl();
  27. void wyswietl_nvirt();
  28. // Przeciążony operator przypisania
  29. void operator =(const Osoba & osoba) {
  30. imie = osoba.imie;
  31. nazwisko = osoba.nazwisko;
  32. }
  33. };
  34.  
  35. class Student : public Osoba {
  36. protected:
  37. float srednia;
  38. string kierunek;
  39. int nr_semestru;
  40. int nr_indeksu;
  41. public:
  42. // Konstruktor domyślny
  43. Student();
  44. // Konstruktor z parametrami
  45. Student(string &imie, string &nazwisko, float &srednia, string &kierunek, int &nr_semestru, int &nr_indeksu);
  46. // Konstruktor kopiujący
  47. Student(const Student &student);
  48. // Destruktor
  49. ~Student();
  50. // Funkcje do wyświetlania danych w konsoli
  51. void wyswietl();
  52. // Przeciążony operator przypisania
  53. void operator =(const Student & student) {
  54. Osoba::operator=(student);
  55. imie = student.imie;
  56. nazwisko = student.nazwisko;
  57. srednia = student.srednia;
  58. kierunek = student.kierunek;
  59. nr_semestru = student.nr_semestru;
  60. nr_indeksu = student.nr_indeksu;
  61. }
  62. };
  63.  
  64. class Pracownik : public Osoba {
  65. protected:
  66. float pensja;
  67. public:
  68. // Konstruktor domyślny
  69. Pracownik();
  70. // Konstruktor z parametrami
  71. Pracownik(string &imie, string &nazwisko, float &pensja);
  72. // Konstruktor kopiujący
  73. Pracownik(const Pracownik &pracownik);
  74. // Destruktor
  75. ~Pracownik();
  76. // Funkcje do wyświetlania danych w konsoli
  77. void wyswietl();
  78. // Przeciążony operator przypisania
  79. void operator =( const Pracownik & pracownik ){
  80. Osoba::operator=(pracownik);
  81. pensja=pracownik.pensja;
  82. }
  83. };
  84. #endif /* KLASY_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement