#include <iostream>
class A
{
public:
A() { f(); }
virtual void f()
{
std::cout << "A::f";
}
};
class B : public A
{
public:
void f()
{
std::cout << "B::f";
}
};
int main(int argc, char * argv[])
{
A * a = new B();
delete a;
return 0;
}
Login in to like
Login in to comment