Design Patterns
|
Flyweight
- References
- Example
-
References
-
Definition: (source: http://en.wikipedia.org/wiki/Flyweight_pattern)
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects;
it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory.
-
Example
-
The
Flyweight
:
-
The
Factory
:
-
A simple class to test the
Flyweight
design pattern: