Polymorphism is one of the important characteristics of object orientation. It refers to the behavior of different objects when they receive the same message. A message refers to a member function of the call class. Different behaviors refer to different implementations, that is, calling different functions. c ++ supports two types of polymorphism: Polymorphism during compilation and Runtime polymorphism;
The polymorphism during compilation is inProgramThe specific objects of function operations are determined during the compilation process and implemented through function overloading. The Runtime polymorphism is that the specific objects of function operations can be determined during the running process, and implemented through virtual functions. For example
Base * P;
Derived B;
P = & B;
P-> disp ();
Because only static syntax checks are performed during compilation, the call object cannot be determined by the form of the optical sub-Statement: p-> disp.