I wonder what really happen if you forget to put virtual keyword in the function of the base class. Will the function still be over-written properly?
What will happen if I
(1) call function from base class pointer
(2) call function from derived class pointer
(3) call function from derived class object
If the virtual keyword is present, the over-written version will be called in all cases, am I mistaken?
Have you tried coding up an example of this in code yourself?
If you omit the virtual keyword, static dispatch will be used instead of dynamic dispatch, so the static type of the variable (versus the dynamic type of the referred to object, which may differ for a pointer or reference) will be used to determine the method called.