* Adam Nielsen: > class Base { > public: > Base() > { > cout << "This is class " << this->number(); > } > > virtual int number() = 0; > };
Roughly speaking, when number() is invoked, the object still has type Base (with a corresponding vtable). One's constructor will change the type once the Base part has been constructed. The following FAQ entry covers this: http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.3