Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class samochod
- {
- public:
- string marka;
- string model;
- float pojemnosc;
- string kolor;
- int rok;
- float cena;
- samochod(string marka, string model, float pojemnosc, string kolor, int rok, float cena)
- {
- this->marka = marka;
- this->model = model;
- this->pojemnosc = pojemnosc;
- this->kolor = kolor;
- this->rok = rok;
- this->cena = cena;
- }
- void wysw()
- {
- cout<<"Marka: "<<marka<<endl;
- cout<<"model: "<<model<<endl;
- cout<<"pojemnosc: "<<pojemnosc<<endl;
- cout<<"kolor: "<<kolor<<endl;
- cout<<"rok: "<<rok<<endl;
- cout<<"cena: "<<cena<<endl;
- }
- };
- class wlasciciel: public samochod
- {
- public:
- string imie;
- string nazwisko;
- int pesel;
- string kod;
- string miejscowosc;
- wlasciciel(string marka, string model, float pojemnosc, string kolor, int rok, float cena,
- string imie, string nazwisko, int pesel, string kod, string miejscowosc)
- :samochod(marka, model, pojemnosc, kolor, rok, cena)
- {
- this->imie = imie;
- this->nazwisko = nazwisko;
- this->pesel = pesel;
- this->kod = kod;
- this->miejscowosc = miejscowosc;
- }
- void wypisz()
- {
- cout<<"Marka: "<<marka<<endl;
- cout<<"model: "<<model<<endl;
- cout<<"pojemnosc: "<<pojemnosc<<endl;
- cout<<"kolor: "<<kolor<<endl;
- cout<<"rok: "<<rok<<endl;
- cout<<"cena: "<<cena<<endl;
- cout<<"-----------------------------------"<<endl;
- cout<<"imie: "<<imie<<endl;
- cout<<"nazwisko: "<<nazwisko<<endl;
- cout<<"pesel: "<<pesel<<endl;
- cout<<"kod: "<<kod<<endl;
- cout<<"miejscowosc: "<<miejscowosc<<endl;
- }
- };
- int main() {
- wlasciciel Osoba("Audi", "A4", 1.6, "Zielony", 1995, 20000,
- "Maciej", "Sajkowsky", 795473858, "40-567", "Zadupie");
- Osoba.wypisz();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement