In other words, why doesn\'t the compiler just \"know\" that if the definition of a function is changed in a derived class, and a pointer to dynamically allocated memory of
One reason:
Consider base classes located in separate module, like library.
And derived classes in your application.
How would compiler knows during compiling the library that the given function is/must be virtual.