/** * testflyweight.cpp */ #include "flyweight.h" void main() { /** * Construct the objects. */ Flyweight* fw1; Flyweight* fw2; FlyweightFactory* factory = new FlyweightFactory(); /** * Get flyweights to use. These will automatically * be created if they are not already alive. */ fw1 = factory -> getFlyweight( "one" ); fw2 = factory -> getFlyweight( "two" ); /** * Clean-up. */ delete factory; }