The role of abstract classes (interface classes)

Source: Internet
Author: User

The role of abstract classes:

1) construct common attributes of subclasses;

2) Define the interface specification for the sub-class.

3) Provide some public service functions (subclass multiplexing);

4) Establish a stable abstraction layer dependency (for ease of overall reuse at the architectural level).

5) Facilitate the expansion of the function, the new sub-class, through the injection interface can be easily linked to the original system structure.

Other points of view:

Abstract class provides partial implementations that enable subclasses to reuse code for some abstract classes
The abstract class provides a common interface for its subclasses (note: This says that my interface is different from the interface in Java)
That is, others can use objects of each subclass as objects of an abstract class.

Abstract classes extract the generality of things and abstract them into a high-level class.

The use of abstract types of unified type, to operate, in favor of future expansion, migration, reuse!!

The role of abstract classes (interface classes)

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.