Detailed explanation of the usage of C++ reloading, redefinition and rewriting
This article mainly introduces "detailed explanation of the usage of C++ reloading, redefinition and rewriting". In daily operation, I believe many people have doubts about the detailed explanation of the usage of C++ reloading, redefinition and rewriting. I have consulted all kinds of materials and sorted out the simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about the usage of C++ reloading, redefinition and rewriting. Next, please follow the editor to study!
1. Overloaded (overloaded function)
Overloaded functions are C++ functions that allow several functions of the same name to be declared in the same scope (in a class) for convenience, but the formal parameters of these functions of the same name (that is, at least one parameter number, type, or order) must be different.
1. The code implements the overloading of the fun () function in a class:
# includeusing namespace std;class Base {public: void fun () {cout