February 26th, 2003, 1:51 pm
I think the point being made is that one can actually have a situation where a function is called which has no implementation at that point. So yes, pure virtual is a compile time concept in that it makes sense for abstract classes only, and abstract classes are not instantiable, but it also has a run time meaning in that classes are constructed via their base classes, and at some points the embryo class doesn't yet have the implementation of the virtual function to hand. Normally a virtual function call resolves to a function implementation, but if one is careless enough to call pure virtual functions in constructors then one can get a situation where the embryo is still a base class and tries to call a function which is implemented in the concrete class. Therefore the following really does call a pure virtual function, i.e. a virtual function which has no resolvable definition at the point of calling:class Abstract{ public: Abstract() {initialise();} virtual void initialise() = 0;};class Concrete : public Abstract{ public: virtual void initialise() {}};somescope{ Concrete concrete; // oops, pure virtual function called}