Compuesto es un patrón estructural que le permite componer objetos en estructuras de árbol y luego trabajar con estas estructuras como si fueran objetos individuales. Trata tanto objetos individuales (hojas) como grupos de objetos (compuestos) a través de la misma interfaz, por lo que el cliente nunca necesita distinguir entre los dos.

Idea central: si el código del cliente tiene que tratar elementos simples y contenedores de manera diferente, resulta más difícil de programar. Composite los hace intercambiables: una carpeta y un archivo responden a getSize(), open(), etc.
Full content is available with a subscription.
Get full access to all courses on the platform for one year with a single payment.
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.