Decorator mode of java--23 design pattern

Source: Internet
Author: User

1: Decorative mode: Decorative mode expands the functionality of the object in a transparent manner to the client, and is an alternative to the inheritance relationship, providing more flexibility than inheritance. Dynamically adds functionality to an object that can be undone on the fly. Adds a very large amount of functionality resulting from the combination of some basic functions. is the ability to dynamically extend an object without having to change the original class file and not use inheritance . It is by creating a wrapper object, that is, decorating to wrap the real object

Fun explanation: DECORATOR-mary to sarly birthday, or do not call her own pick, otherwise this month food is sure to finish, take out my last year in China on the top of the photo, write on the back "the best gift, is Love your Fita", And then to the street gift shop to buy a box (selling gifts mm is also very beautiful OH), and then find the next door to make art design Mike designed a beautiful box installed up ..., we are all decorator, and finally all in the decoration of my this person ah, how, understand? Interesting explanations See also: http://blog.jobbole.com/20496/

Implemented in Java code:

Decorator mode of java--23 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.