Post

Structural_Composite Pattern

βœ… Composite pattern

  • 🌲 tree structure

  • Client will not know if it is using composite or leaf
  • can treat the groups of objects or individual objects in same manner
  • πŸ‘‰πŸ» part whole hierarchy
  • composite objects into tree structure
  • treat individual objects and composite objects uniformly

βœ”οΈ Structure of the composite pattern

  • component: common interface
  • declare operations common to composite and leaf
  • composite: groups of object, can have other component as attribute
  • leaf: last of tree(no children)

βœ… Diagram

Screenshot-2026-03-03-at-10-45-21.png

βœ…

βœ…

βœ…

This post is licensed under CC BY 4.0 by the author.