Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. #include "stdafx.h"
  2. using namespace std;
  3. class Adres
  4. {
  5. protected:
  6.     string m_miasto;
  7.     string m_ulica;
  8.     int m_numer;
  9. public:
  10.     Adres(string miasto, string ulica, int numer)
  11.         :m_miasto(miasto), m_ulica(ulica), m_numer(numer)
  12.     {
  13.         cout << "Konstruktor klasy Adres" << endl;
  14.  
  15.     }
  16.     void adres(string miasto, string ulica, int numer)
  17.     {
  18.         m_miasto = miasto;
  19.         m_ulica = ulica;
  20.         m_numer = numer;
  21.     }
  22.     void virtual wyswietl()
  23.     {
  24.         cout << "Miasto: " << m_miasto << " ulica: " << m_ulica << " numer: " << m_numer << endl;
  25.     }
  26.  
  27.  
  28.  
  29.     virtual ~Adres()
  30.     {
  31.         cout << "Destruktor klasy Adres" << endl;
  32.     }
  33. };
  34.  
  35. class TOsoba
  36. {
  37. private:
  38.     string m_imie;
  39.     string m_nazwisko;
  40.     int m_wiek;
  41.     Adres m_adres;
  42. public:
  43.     TOsoba(string imie, string nazwisko, int wiek, Adres adres)
  44.         : m_adres(adres),
  45.         m_imie(imie),
  46.         m_nazwisko(nazwisko),
  47.         m_wiek(wiek)
  48.  
  49.     {
  50.  
  51.     }
  52.     virtual void wyswietl()
  53.     {
  54.         cout << m_imie << m_nazwisko << m_adres<<endl;     //<--------wyskakuje błąd "while trying to match the argument list //'(std::basic_ostream<char,std::char_traits<char>>, Adres)"
  55.  
  56.  
  57. // oraz świeci się na czerwono "no operator "<<" matches these operands operand types are: std::basic_ostrean<char,std::char_traits<char>><<Adres
  58.     }
  59.     string PodajImie()
  60.     {
  61.         return m_imie;
  62.     }
  63.     string PodajNazwisko()
  64.     {
  65.         return m_nazwisko;
  66.     }
  67.  
  68. };
  69. class TStudent : public TOsoba
  70. {
  71. public:
  72.     TStudent(string m_imi, string m_nazwisk, int wie, string kierunek, int rok, Adres adres)
  73.         :TOsoba(m_imi, m_nazwisk, wie, adres),
  74.         m_kierunek(kierunek),
  75.         m_rok(rok)
  76.     {
  77.  
  78.     }
  79.     virtual void wyswietl()
  80.     {
  81.  
  82.     }
  83.     string kierunek()
  84.     {
  85.  
  86.     }
  87.  
  88. private:
  89.     string m_kierunek;
  90.     int m_rok;
  91. };
  92.  
  93.  
  94.  
  95. int main()
  96. {
  97.  
  98.  
  99.     return 0;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement