In today's succession review, I have a new insight into the attributes of inheritance------> Subclass inherits the parent class, inherits the parent class's methods and properties, and looks at the following figure
Inheritance---> Properties (two ways to call the parent class with the same name in a subclass) ">
As you can see from the diagram above, even if the subclass is an empty shell, he gets to the parent class's property name and Method Test () from the parent class.
But the next thing I'm talking about is a little focus---> in inheritance, subclasses inherit the attributes of the parent class and inherit methods differently
---> Parent properties cannot be overridden, are invoked only, the parent-class method can be overridden, or can be invoked
---> When a subclass has a property with the same name as the parent class, the Parent property is hidden, and when the property is invoked in a polymorphic state, the parent class attribute subclass property is hidden, and the method is not hidden and, once overridden, can only be invoked in the subclass by using super
Next, two ways to invoke a property of the parent class with the same name in the subclass (that is, to activate the hidden parent class property in the subclass)
Inheritance---> Properties (two ways to call the parent class with the same name in a subclass) ">
Summary: In inheritance, attributes are not overridable and will only be hidden
Method will be overridden and will not hide