Polymorphism:
Operator overload
The operator overload is implemented by creating the operator function operator. Example: complex operator + (complex A, complex B ){}
Generally, you can use the following two methods after using the member function to overload the binary operator +:
AA + BB or AA. Operator + (bb)
Pointer relationship between base class and derived class
1. The Declaration refers to a pointer to a base class object that can point to its public-derived object, but cannot point to its private-derived object.
2. A pointer to a derived class object cannot be directed to its base class object.
3. the Declaration refers to a pointer to the base class. When it points to an object of a public derived class in the current period, it can only be used to directly access the members inherited from the base class in the derived class, you cannot directly access the Members defined in the public derived class.
Virtual Functions
A virtual function must be a member function of its class, not a friend function or a static member function. However, a virtual function can be declared as a friend function in another class.
Pure virtual functions
Virtual void show_area () = 0
If a class has at least one pure virtual function, the class is called an abstract class. An object of an abstract class cannot be declared, but a pointer can be declared or referenced. This pointer can point to its derived class to implement polymorphism.