mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-09-07 12:10:40 +02:00
18 lines
317 B
C++
18 lines
317 B
C++
#include <iostream>
|
|
|
|
class Baza {
|
|
public:
|
|
virtual void metoda() const { std::cout << "Baza" << std::endl; }
|
|
};
|
|
|
|
class Pochodna : public Baza {
|
|
public:
|
|
void metoda() const { std::cout << "Pochodna" << std::endl; }
|
|
};
|
|
|
|
int main() {
|
|
Pochodna p;
|
|
Baza b = p;
|
|
b.metoda(); // część pochodna została zgubiona
|
|
}
|