I'm trying to make a Composite Pattern that counts the number of people in the world, the continent, the state ...
Here is the pattern that I follow:
but I am not sure it's right, because can I use leaf -> population
?
Because when I did Composite Pattern for PC so its (PC= component from PC will be Cabinet = composite, from Cabinet will be HDD= leaf and Motherboard = composite, from Motherboard will be RAM = leaf and CPU = leaf). What I want to say every leafs are different and in my diagram are same.
and you think I have something good at least.
Maybe this solution is better:
Thank you for your answers :)
Aucun commentaire:
Enregistrer un commentaire