Int Main (Target Target New Adapter
Int Main (Target Target New Adapter
int main() {
Target *target = new Adapter();
target->Request();
delete target;
return 0;
bridge
Composite:
Component - Component is the abstraction for leafs and composites. It defines the interface that
must be implemented by the objects in the composition. For example a file system resource
defines move, copy, rename, and getSize methods for files and folders.
Leaf - Leafs are objects that have no children. They implement services described by the
Component interface. For example a file object implements move, copy, rename, as well as
getSize methods which are related to the Component interface.
Composite - A Composite stores child components in addition to implementing methods
defined by the component interface. Composites implement methods defined in the Component
interface by delegating to child components. In addition composites provide additional methods
for adding, removing, as well as getting components.
Client - The client manipulates objects in the hierarchy using the component interface.
Decorator:
Component - Interface for objects that can have responsibilities added to them
dynamically.
Abstract factory
Client - uses the interfaces declared by the AbstractFactory and AbstractProduct classes.
Factory Method:
Product defines the interface for objects the factory method creates.
Creator(also refered as Factory because it creates the Product objects) declares the
method FactoryMethod, which returns a Product object. May call the generating method for
creating Product objects