Mail Archives: djgpp/1998/03/18/11:49:59
>> > the message "Pure virtual function called" (using DJGPP of course, gcc
>> > 2.7.2.1).
>>
>> The most obvious way how to get this message is to call virtual function
>> from constructor or destructor of base class when this virtual function
is
>> redefined in inheritted class
>
>Why is this a runtime error? Can't the compiler locate this bug?
No it can't because when it is compiling the function call, the compiler
can't know if the pure virtual function will be overridden in some
descendent
class.
You can think like if it was a call to a function pointed by some pointer,
how
could you know at compile time if at runtime it will be NULL or point to a
valid
function? (C++ purists forgive me for this example :-)
ciao
Giacomo
- Raw text -