The constructor (constructor) is a special method. It is used primarily to initialize an object when it is created, to assign an initial value to an object member variable, and to always use the new operator in the statement that creates the object. A particular class can have more than one constructor, which is an overload of the constructor, depending on the number of arguments or different types of arguments. The function of a constructor is primarily used to define the state of the initialization when the class's object is created.
Constructs an object that first calls its constructor method to initialize its member functions and member variables.
A subclass has member variables and member methods of the parent, and if not called, the member variables and member methods inherited from the parent class are not properly initialized.
This can not be called in turn, because the parent class does not know that the child is a divine demon variable and that the subclass is not initialized with the parent class variable, causing the program to run an error!
Why do I have to call the construction method of the parent class before the constructor of the subclass is run? Can you turn around? Why can't it be reversed?