There are two common reasons for that problem:
- You are calling a virtual function from a constructor or destructor of your base class.
The problem is that at the point when the base class constructor is called, the vtable has not been initialized with the function pointers of the overridden member functions in the derived class, which means they still point to the implementations in the class whose constructor they are called from. If that class is purely virtual, there you have your virtual function call. The problem is the same for destructors, only in reverse.
There is another important lesson to be learned here: If you call a regular virtual function from a base class, on most compilers you actually call the version in the base class, NOT the overridden one in your derived class. - You already called delete on your pointer.
This one is the one most textbooks don't tell you about because it is compiler dependent. But if you have a dangling pointer, and you call a virtual function on it, you often get this error, too.