In fact, the overload of the constructor is nothing more than implementing the definition of several functions, and then specifying different parameters. The simplicity is not reflected in the definition, but in the use. Only one function name is called, you can perform different operations.
Pointer in Object-Oriented:
Pointer to the object;
Time * PT
Time T1;
PT = & T1;
Here is the definition method of the pointer to the object in the object-oriented pointer.
Pointer to an object Member
Pointer data type name * pointer variable name pointing to object members
For example, P1 = & ti. Hour cout <* P1 <Endl;
(2) pointer data type name * (pointer variable name) (parameter variable) pointing to the member function)
For example, void (* p) (); // P is a pointer variable pointing to the void type.
It can point to a function and call the function through the pointer variable:
P = fun; // pay the function entry address to the pointer Variable P, and P points to the function fun.
(* P) (); // call the fun Function
(The biggest difference between a member function and a common function is that it is a member of a class.
The compilation system requires three matching measures when compiling pointer and function assignment:
Function parameter type and number of parameters & function return value & Class
)
(3) the pointer variable that defines the function pointing to the common member function is generally formatted
Data Type name (Class Name: * p) (parameter list)
Void (Time: * P3) (); // defines the pointer variable pointing to the time class shared member function
P3 = & time: get_time; // Let the pointer P3 point to the time class public member function get_time
(The preceding two sentences can be combined into one line: void (Time: * P3) () = & time: get_time)