Advertisement
programusy

Untitled

Feb 9th, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class pojazd
  6. {
  7. public:
  8. string typ;
  9. int ilosc_p;
  10. pojazd(string t,int p) : typ(t), ilosc_p(p) {}
  11. };
  12.  
  13. class motocykl :: public pojazd()
  14. {
  15. private:
  16. int pojemnosc;
  17. int predkosc;
  18. public:
  19. motocykl() {};
  20. motocykl(string t,int p, int s, int m) : pojazd(t,p), pojemnosc(s),predkosc(m) {}
  21.  
  22. void wypisz()
  23. {
  24. cout << "Typ: " << typ << "Ilosc: " << ilosc_p << "Pojemnosc: " << pojemnosc << "Predkosc: " << predkosc << endl;
  25. }
  26.  
  27. };
  28.  
  29. /*class autobus :: public pojazd()
  30. {
  31. private:
  32. string przewoz;
  33. string kolor;
  34. };
  35. */
  36. int main()
  37. {
  38. motocykl yamaha("yamaha",1,10,100);
  39. yamaha.wypisz();
  40. cout << "Hello world!" << endl;
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement