6. Inheritance of classes
The essence of inheritance is code reuse. Constructing a new class does not require writing from scratch, inheriting the existing classes directly, and adding new properties and methods on top of it.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5D/DB/wKioL1Ul7wuzkYTBAAMAmXUA9ek035.jpg "title="%m[ Kqfxnigf%p~ ' Q$]2wjb6.png "alt=" wkiol1ul7wuzkytbaamamxua9ek035.jpg "/> inheritance contains such a problem, the sub-class and the parent class conversion problem. Remember, subclasses can be assigned to a parent class, and vice versa. It can be understood that the subclass inherits all of the parent class, and also expands on this basis, larger than the parent class, so assigning to the parent class loses precision, but can run. Conversely, the parent class is assigned to subclasses, then to enlarge the precision, how to enlarge??? later, we will talk about the polymorphism of the class, which involves the problem of the virtual function table. Novice can not understand the private messages I ah.
This article from "Very blog" blog, reproduced please contact the author!
C # self-study Road 06