Overload overloaded:
Several functions with similar functions are represented by the same name, but with different arguments (including different types and orders), that is, function overloading.
- Same scope (in the same class)
- Same function name
- Different parameters
- The virtual keyword is optional.
Note that overload resolution does not take into account return types —— same function name, different arguments in the same range — overload
Override — Override:
A derived function overrides a base function, which is a representation of C++ polymorphism.
- Different scopes (in derived and base classes)
- The function has the same name
- Parameters are the same
- Return the same value
- Base class functions must have the virtual keyword
- Classes that contain pure virtual functions are called abstract classes and cannot be instantiated.
———- Derived functions are identical to base functions and have the virtual keyword, allowing them to be overridden by derived classes
Overwrite – redefinition
- In different scopes (derived and base classes)
- Same function name
- The return value can be different
- Different arguments, with or without the virtual keyword, base class functions are hidden
- The arguments are the same, but the base function does not have the virtual keyword, and the base class function is hidden
- When a derived class overrides /overwite on a base-class function, the derived class uses its own override/overwite function, otherwise it uses the base-class function
- Overrides occur between base and derived classes when a function has the same name but different arguments, whether virtual or not, or when a function has exactly the same name and argument but without the virtual keyword. The function methods of the base class are hidden. But you can use the qualifier :: reference.