First, overload
Occurs in the same class, when method A is defined in the same class, and then the method b,b and a are defined with the same name, but the parameters are different, then the B overloads the method A.
class test{public: void A (); void A (int);}
Second, cover
Occurs in the subclass and parent class, the method A is defined in the parent class, and it is the virtual type, and the method A is defined again in the subclass, with the same parameters as the parent class. This is called a subclass of method A that overrides method A in the parent class.
class Base {public: virtualvoid fun (int);} class D:publicbase{public: void Fun (int);}
Third, hidden
Occurs in the subclass and parent class, if method A is defined in the parent class, the method A with the same name is defined again in the self-class, but the parameters are different, and this is the method in the parent class that is masked out.
For example
class test{public: void fun ();} class D: public test{public: void fun (int );}
New d;t->fun (); // OKt->fun (k); // Error
That is, the method in the derived class must not be called by the base class, which is actually not related to hiding, just the effect of class inheritance and polymorphism.
d dd;d.fun (); // errorD.fun (N); // OK
The above meaning is called by the derived class in the parent class, has been masked method, will error
The way to solve the problem is to use the using
class D: public test{public: ... .. using Test:fun;}
c++--overloading, overwriting, and hiding