virtual functions

closed account (j8Mo2yTq)
if I make a virtual function in the base class it does not seem to matter if the derived classes have the virtual keyword or not for that overriden function. the behavior seems the same and the correct function is called using a base class pointer regardless. Is there something im missing by not using the virtual keyword for a overriden derived function if the base class for that function already is virtual? on some examples online the derived class overridden functions are using virtual even though the base class for that function is already virtual and some examples the virtual keyword is left out on the derived function. is there a difference or preference?
if I make a virtual function in the base class it does not seem to matter if the derived classes have the virtual keyword or not for that overriden function.


Yes.

Is there something im missing by not using the virtual keyword for a overriden derived function if the base class for that function already is virtual?


No.

You only need virtual in the base class.
closed account (j8Mo2yTq)
ok thanks for the reply.
Topic archived. No new replies allowed.