About when to use inheritance when combining

Source: Internet
Author: User
Not found extremely strongly irrefutable use of the reasons for inheritance all use the combination of composition embodied as the implementation level, the inheritance is mainly embodied in the extension aspect I think if you do not need a class of all things (including interfaces and attributes), then you do not need to use the inheritance, instead of the combination. With inheritance that must be all inherited, not all inherited, then abuse of inheritance. The combination is better than inheritance in compiling dependencies and different versions of run-time compatibility; the potential of inheritance in the rational reuse is superior to the collective inheritance, and the special Collective (derived class) can be regarded as part of a general collective (base class), such as a vehicle for transportation. A feature object is considered a part of a host object, such as a wheel for a car. With regard to the perspective of things, inheritance of the partial abstraction, the combination of partial specific.

About when to use inheritance when combining

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.