Ii. Java Object-oriented (15) _ Template Method design pattern

Source: Internet
Author: User

2018-05-06

Template Method Design pattern

The skeleton of an algorithm in an operation is defined in a method of the parent class, and some steps are deferred to the subclass because the implementation details of the different subclasses are different. The template method allows subclasses to redefine some specific steps of the algorithm without altering the structure of an algorithm.

Abstract Parent class: defines the business skeleton in the operation, and defers these steps to the subclass.

The abstract parent class provides at least two methods:

1) Template method: A general approach, that is, the template (skeleton of the overall algorithm).

2) abstract method: a specific business function implementation, complete by subclasses.

Reference:https://www.cnblogs.com/liaoweipeng/p/5790395.html

51868973

Ii. Java Object-oriented (15) _ Template Method design pattern

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.