class A
{
protected:
virtual void v() = 0;
public:
void f()
{
std::cout << "A::f()" << std::endl;
this->v();
}
protected:
A()
{
std::cout << "A::A()" << std::endl;
this->f();
}
};
class B: public A
{
private:
virtual void v()
{
std::cout << "B::v()" << std::endl;
}
};
int main()
{
A *pa = new B;
pa->f();
return 0;
}
Login in to like
Login in to comment