Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- using namespace std;
- class Adres
- {
- protected:
- string m_miasto;
- string m_ulica;
- int m_numer;
- public:
- Adres(string miasto, string ulica, int numer)
- :m_miasto(miasto), m_ulica(ulica), m_numer(numer)
- {
- cout << "Konstruktor klasy Adres" << endl;
- }
- void adres(string miasto, string ulica, int numer)
- {
- m_miasto = miasto;
- m_ulica = ulica;
- m_numer = numer;
- }
- void virtual wyswietl()
- {
- cout << "Miasto: " << m_miasto << " ulica: " << m_ulica << " numer: " << m_numer << endl;
- }
- virtual ~Adres()
- {
- cout << "Destruktor klasy Adres" << endl;
- }
- };
- class TOsoba
- {
- private:
- string m_imie;
- string m_nazwisko;
- int m_wiek;
- Adres m_adres;
- public:
- TOsoba(string imie, string nazwisko, int wiek, Adres adres)
- : m_adres(adres),
- m_imie(imie),
- m_nazwisko(nazwisko),
- m_wiek(wiek)
- {
- }
- virtual void wyswietl()
- {
- 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)"
- // oraz świeci się na czerwono "no operator "<<" matches these operands operand types are: std::basic_ostrean<char,std::char_traits<char>><<Adres
- }
- string PodajImie()
- {
- return m_imie;
- }
- string PodajNazwisko()
- {
- return m_nazwisko;
- }
- };
- class TStudent : public TOsoba
- {
- public:
- TStudent(string m_imi, string m_nazwisk, int wie, string kierunek, int rok, Adres adres)
- :TOsoba(m_imi, m_nazwisk, wie, adres),
- m_kierunek(kierunek),
- m_rok(rok)
- {
- }
- virtual void wyswietl()
- {
- }
- string kierunek()
- {
- }
- private:
- string m_kierunek;
- int m_rok;
- };
- int main()
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement