The action
declared in the derived class hides the action
declared in the base class. If you use action
on a Son
object the compiler will search in the methods declared in Son
, find one called action
, and use that. It won’t go on to search in the base class’s methods, since it already found a matching name.
Then that method doesn’t match the parameters of the call and you get an error.
See also the C++ FAQ for more explanations on this topic.