fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class Pojazd {
  7. public:
  8. string rocznik;
  9. string nrVin;
  10. string przebieg;
  11. unsigned int cena;
  12. Pojazd(string rocznik, string nrVin, string przebieg, unsigned int cena) {
  13. this->rocznik = rocznik;
  14. this->nrVin = nrVin;
  15. this->przebieg = przebieg;
  16. this->cena = cena;
  17. }
  18. virtual ~Pojazd() {}
  19. };
  20.  
  21.  
  22. class Samochod : public Pojazd {
  23. public :
  24. string marka; // <- Zmienna składowa klasy samochod
  25. string model;
  26. unsigned int wielkoscOpon;
  27. Samochod (string marka, string model, string rocznik, string nrVin, string przebieg, unsigned int cena, unsigned int wielkoscOpon ) :
  28. Pojazd(rocznik, nrVin, przebieg, cena) {
  29. this->marka = marka;
  30. this->model = model;
  31. this->wielkoscOpon = wielkoscOpon;
  32. }
  33. ~Samochod(){}
  34. };
  35.  
  36. int main() {
  37. Samochod *tmpSamochod;
  38. tmpSamochod = new Samochod("qwe", "asd", "123", "987", "456", 23456, 234);
  39. return 0;
  40. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Standard output is empty