C + + rewrite heavy load definition differences
(From: Http://blog.163.com/[email protected]/blog/static/111352259201102441934870/)
1 member function overloading features:
A the same range (in the same class)
The B function has the same name
C parameter is different
D virtual keyword is optional
2 override (overwrite) refers to a derived class function that overrides a base class function, characterized by:
A different range, located in the base class and the derived class, respectively
The name of the B function is the same
Same as C parameter
The D base class function must have the virtual keyword
3 redefinition (hidden) refers to a function of a derived class that masks a base class function with the same name as the following rule:
A If the function of the derived class and the function of the base class have the same name, but the arguments are different, at this point, the function of the base class is hidden, regardless of whether or not virtual.
b If the function of the derived class has the same name as the function of the base class, and the parameters are the same, but the base class function does not have the Vitual keyword, the function of the base class is hidden.
C + + rewrite heavy load definition differences