Summary
In this post, I will introduce function override and function overload in C++, which are introduced by polymorphism in object oriented programming.
Conclusion
Overload
- Function overloadding achieves at compile time.
- It provides multiple definitions of the function by changing signature. Changing signatures includes changing number of parameters, change datatype of parameters. Note that return type doesn’t play anyrole.
- Overloading can occur without inheritance.
- Chinese: 方法重载.
Override
- Function Overridding achieves at run time.
- It is the redefinition of base class function in its derived class with same signature i.e return type and parameters.
- Chinese: 方法重写.