0
Answer

Where we can apply composite pattern in real life ?

mursaleen fayyaz

mursaleen fayyaz

11y
1.1k
1
Hi people,

I am sharing one real example, and expecting one example from your side.

First we see what is the definition of Composite Pattern ?

"Compose objects into tree structures to represent part-whole hierarchies. Composite lets the clients treat individual objects and composition of objects individually."

Leaves and branches of tree treated as Same. (No distinction)

Real Example:
Suppose you are an HR office in a company, and you send the same email notice to different people in a company.
If you are write email address of individuals in "To" box. I will recommend you to apply composite pattern for it. Make it sample and create Group of individuals.

Thanks,
Mursaleen Fayyaz
Jr.Software Engineer.