Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class pojazd
- {
- public:
- string typ;
- int ilosc_p;
- pojazd(string t,int p) : typ(t), ilosc_p(p) {}
- };
- class motocykl :: public pojazd()
- {
- private:
- int pojemnosc;
- int predkosc;
- public:
- motocykl() {};
- motocykl(string t,int p, int s, int m) : pojazd(t,p), pojemnosc(s),predkosc(m) {}
- void wypisz()
- {
- cout << "Typ: " << typ << "Ilosc: " << ilosc_p << "Pojemnosc: " << pojemnosc << "Predkosc: " << predkosc << endl;
- }
- };
- /*class autobus :: public pojazd()
- {
- private:
- string przewoz;
- string kolor;
- };
- */
- int main()
- {
- motocykl yamaha("yamaha",1,10,100);
- yamaha.wypisz();
- cout << "Hello world!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement