From my previous understanding of inheritance function defined by Line 1 is redundant.
(1) Why do we need it, since if I delete it, there is an error?
Line 1 defines a different form of the action method, taking a different parameter. The fact that it's virtual is irrelevant; the derived class Son does not override it. In fact this is the method called in main, since a char, rather than a char*, is passed to action().
(2) Why do we need the Line 2?
When a derived class overrides a method, it "shadows" all other methods with the same name from farther up the hierarchy by default. There are complex reasons for this, but just take it as written. The "using" statement here tells the compiler to also look in the base class while trying to resolve the function call. This isn't needed unless you have a situation like this one, where several different methods have the same name and not all of them are overridden.
Bookmarks