Should be a newbie question...
I have existing code in an existing class, A, that I want to extend in order to override an existing method, A::f().
So now I want to create class B to override f(), since I don t want to just change A::f() because other code depends on it.
To do this, I need to change A::f() to a virtual method, I believe.
My question is besides allowing a method to be dynamically invoked (to use B s implementation and not A s) are there any other implications to making a method virtual? Am I breaking some kind of good programming practice? Will this affect any other code trying to use A::f()?
Please let me know.
Thanks, jbu
edit: my question was more along the lines of is there anything wrong with making someone else s method virtual? even though you re not changing someone else s implementation, you re still having to go into someone s existing code and make changes to the declaration.