Here's a simple example of the composite pattern in pseudocode:
interface ComputerParts is
method connect()
class SystemUnit implements ComputerPart is
field parts: array of ComputerParts
constructor of SystemUnit ...
method add(part: ComputerPart) is ...
method connect() is
foreach (part in parts) do
part.connect()
class GPU implements ComputerParts is
constructor of GPU ...
method draw() is ...
method connect() is ...
class HDD implements ComputerParts is
constructor of HDD...
method boot() is ...
method connect() is ...
method store() is ...
Sort classes of this snippet by their types.