Let's start from the root of the hierarchical tree structure, so we have the worker interface here
that has only a method that will be implemented into leaf objects.
And we also have to leave objects, the human and the robot, both are kind of the same.
They have two properties, only the name and department.
We have the implementation of the preferred method with a single outline just for the sake of simplicity.
We have getters and setters for each property and a two string method that will be used in the main
method to output the name and the department of each robot and human worker.
We also have the composite class and here it is.
It implements the worker and has the methods for dealing with adding and removing workers such as human
and robot employees.
And also it has the two string method that we see here which outputs the names or and the departments
of all the human and robot employees.
So let's see the main method here.
So basically we create a human and a robot with a name and department and also a work manager that will
add the human and the robots in the corresponding lists.
And also the CSA will output the all the things that are contained in that list.
So let's see this in action.
Let's run this main method so we can see that the human workers are and we get the name the two string
implementation of the human class and the robot workers are this one two string representation of the
robot class.
That's it.
Four for the composite pattern.
And join me in the next video where we are going to discuss about decorator's.
So see you in the next tutorial.