what if I redefine a method of a base class and set it as "virtual" in a derived class in a chain of deriving actions?

Apr 22, 2014 at 7:19am
like the title.

Is it legal? And what will it be?
Apr 22, 2014 at 7:48am
The title doesn't make much sense. To "redefine" a method of the base class you have to change the implementation of that method.

If your answer is "How do I override a nonvirtual base class method?" the answer is "You don't." You can overload the function, which will hide the base class method of the same name when in the scope of the derived class, but you cannot override a function that is not virtual.

http://ideone.com/xM2VtW
Topic archived. No new replies allowed.