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
virtual
keyword tells the compiler to implement dynamic dispatch.That is how the language was designed.
Without such an keyword the compiler would not know whether or not to implement dynamic dispatch.
The downside of virtual
or dynamic dispatch in general is that,