prawie zrobione zadania

This commit is contained in:
2026-05-12 16:51:57 +02:00
parent 6270be5805
commit 399f1218f4
20 changed files with 396 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#include <iostream>
#include <ostream>
#include <string>
class Pojazd {
public:
virtual std::string opis() = 0;
virtual ~Pojazd() = default;
friend std::ostream &operator<<(std::ostream &os, Pojazd &p) {
os << p.opis();
return os;
}
};
class Samochod : public Pojazd {
public:
std::string opis() override { return "To jest samochód"; }
};
class Rower : public Pojazd {
public:
std::string opis() override { return "To jest rower"; }
};
int main() {
Samochod s;
Rower r;
std::cout << s << std::endl;
std::cout << r << std::endl;
}