I tried to understand virtual functions.
Consider the following code:
#include <iostream>
}
With the virtual I get output
I eat like a generic animal. I eat like a wolf!
as it should be.
But if I delete the virtual keyword, I still get the same result! From my basic understanding of virtual functions, without virtual I had to get a way out
I eat like a generic animal. I eat like a generic animal.
Is there anything elementary here I am missing?
I am using g ++ compiler on Linux
source share