C # self-study Road 06

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.