Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

examp4.cpp

This example is to show use of the Bridge and Prototype patterns.

In our scenario we want to enable the choice of car engines between six (6) and eight (8) cylinders. The advantage that the Bridge pattern brings to the problem domain is that it can be dynamically configured to work with either concrete engine type. We have concrete engines as types instead of a factored engine with a cylinder attribute for example purposes.

Because the base Bridge calls cloneImplementation in EngineBridge the Prototype pattern is suited for Engine becuase we want to create a Engine based on the prototype that the Bridge is responsible for.

See also:
Engine.hpp EngineBridge.hpp


This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium