Abstraction Supreme

A file system has files and directories. Directories can contain files and other directories. You want client code to treat individual files and directories uniformly (e.g., both support getSize()). Which pattern models this?

A

Facade: provide a simplified file system interface that hides the tree structure

B

Decorator: wrap files with directory functionality

C

Composite: define a component interface that both files (leaves) and directories (composites) implement

D

Flyweight: share file metadata across duplicate files to save memory