Knocking on the door of C #-inheritance,
Record some concepts for memo.
Second in life, second in life, and third in life. Class generation, endless growth.
The difference between rewriting and overloading:
Overload refers to the method with the same name but different parameters in the same class.
Override refers to the method inherited by the base class in the derived class in the inheritance relationship. In this case, the base class and the derived class have two methods with the same name.
The execution process of the constructor In the derived class:
First, the base class constructor is called to initialize the variables of the derived class, which is a process of gradually building from the base class to the derived class. When deleting an object, first call the destructor of the derived class, destroy the variables of the derived class, then call the function of the base class, and destroy the variables of the derived class. This process is like wearing clothes. When wearing clothes, first wear the innermost layer of the clothes, and then wear the outer layer of the clothes; when taking off the clothes, first take off the outer layer of the clothes, and then take off the inner layer of the clothes.