#include using namespace std; class Figura { protected: int height; public: Figura(int height = 0) : height(height) { } virtual void what() { cout << "Figura: h=" << height <what(); // Prostokat rf.what(); // Prostokat // p->what(); nie, bo what prywatne w Prostokat // Ale ponizsze legalne! ((Figura*)p)->what(); // Prostokat ((Figura&)*p).what(); // Prostokat // OK: wersja publiczna z klasy bazowej Figura p->Figura::what(); // Figura }