Decorator Design Pattern

Decorator pattern allows a user to add new functionality to an existing object without altering its structure.

This type of design pattern comes under structural pattern.

This pattern creates a decorator class which wraps the original class and provides additonal functionality keeping class methods signature intact.

Below diagram and code is an example of the Decorator Design Pattern.

 

posted @ 2019-07-26 18:29  CodingYM  阅读(172)  评论(0编辑  收藏  举报