If you have a method of the Base class declared as virtual , to override it you need to provide a function with the same signature in the Derived class ( options for returning covariants are allowed).
If your function name is the same, but the signature in the Derived class is different from the one in the base class, and it no longer pays for it, this is the function Hiding , the method of the derived class hides the method of the Base class.
The Overload function is never performed by class . You can overload methods within a single class or free functions, but not through classes. When you try to do this in classes, what you end up with is hiding the function.
To bring the base class methods to the scope of the Derived class, you need to add add using functionName to your Derived class.
EDIT:
As for Q, when to use virtual for overloading, the answer is:
If you intend to override the functions of your class for run-time polymorphism , you should mark them as virtual , and not if you do not intend to.
Good reading:
When to mark a function in C ++ as virtual?
Alok save
source share