Using Composite pattern in Java project

Опубликовано: 09 Февраль 2025
на канале: Improve Your Programming skills
98
1

Composite pattern(structural design pattern) compose objects into tree
structures to represent whole-part hierarchies.
In a Company Management application, it has directors and
under directors, there can be managers and under managers
there can be developers. We can apply Composite pattern to do that

Steps to implements
1. Create an abstract class Employee
2. Create a Developer class extends Employee
3. Create a Manager class extends Employee. The Manager class
contains a list of Employee
4. Create a Director class extends Manager.