Composite: This class represents branch node or composite component in the tree structure.Leaf: This class represents leaf node in tree structure.It represents the node in the tree structure. This is the interface for the object in composition. IComponent: This is an interface that will be implemented by both the Leaf class and Composite class.The node having no child node is the leaf node. Composite lets clients treat individual objects and compositions of objects uniformly.Įvery node in the tree structure can be divided into branch node or leaf node. The group of objects and the single object will be the part of the tree structure.Ĭompose objects into tree structures to represent part-whole hierarchies. With composite pattern, client treat a group of objects and a single object as the same, but actually they are different. Within the tree structure every element is responsible to perform a task. Composite Design PatternĬomposite pattern is used when you need to set up objects into the tree structure to represent part-whole hierarchy. This article explains what is composite pattern and how to implement composite design pattern in C#. Composite design pattern comes under structural design pattern category of Gang of four (GoF) design patterns.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |