What is the difference between class inheritance and rewriting?
Class Inheritance refers to the existence of an inherited member A in the parent class, but the member with the same name does not exist in the subclass. In this way, the member will be inherited to the subclass, when a subclass object accesses this member, it actually accesses the corresponding member of the parent class.
Class rewriting refers to the existence of inherited member A in the parent class, and the member with the same name exists in the subclass. In this way, the member will be overwritten by the Child class. When the child Class Object accesses the member, actually accessed is a member of the subclass.
The difference between the two is that, when rewriting, the accessed rewriting member and the parent class are actually irrelevant, while the inherited member accesses the parent class member.