...

/

Flyweight: Implementation and Example

Flyweight: Implementation and Example

Learn the Flyweight design pattern by implementing an example program.

Implementing the Flyweight design pattern

Let’s imagine we’re building a strategy video game that would allow players to build large armies. This army would consist of different types of soldiers. However, all these soldier types would have some common properties. Only the values of these properties would be ...