Overload:
Only the
member functions with the same name in the same class definition have an overload relationship
. The main feature is
that the types and numbers of parameters of the functions are different
, but
the number and types of function parameters cannot be the same
, and they are distinguished only by the different types of return values. function, which is exactly the same as the overloading of ordinary functions. In addition, overloading has nothing to do with whether the member function is virtual or not
cover:
Overriding the function of the same name in the base class in the derived
class requires that the number of
parameters
are the same, and the base class function must be a virtual function.
hide:
The function in the derived class masks the function of the same name in the base class,
The 2 function parameters are the same, but the base class function is not a virtual function (
the difference from overriding is whether the base class function is a virtual function
). The two function parameters are different. Regardless of whether the base class function is a virtual function, the base class function will be masked (
the difference from overloading is that the two functions are not in the same class
).