creativity is that spark of electricity before an explosion.
it allows us, in a single instance to explore all possibilities without hesitation.
|
// Bridge pattern -- Structural example
|
|
using
System;namespace { // MainApp test application class MainApp { static void Main() { Abstraction ab = new RefinedAbstraction(); // Set implementation and call ab.Implementor = new ConcreteImplementorA(); ab.Operation(); // Change implemention and call ab.Implementor = new ConcreteImplementorB(); ab.Operation(); // Wait for user Console.Read(); } } // "Abstraction" class Abstraction { protected Implementor implementor; // Property public Implementor Implementor { set{ implementor = value; } } public virtual void Operation() { implementor.Operation(); } } // "Implementor" abstract class Implementor { public abstract void Operation(); } // "RefinedAbstraction" class RefinedAbstraction : Abstraction { public override void Operation() { implementor.Operation(); } } // "ConcreteImplementorA" class ConcreteImplementorA : Implementor { public override void Operation() { Console.WriteLine("ConcreteImplementorA Operation"); } } // "ConcreteImplementorB" class ConcreteImplementorB : Implementor { public override void Operation() { Console.WriteLine("ConcreteImplementorB Operation"); } } } and
Output expected:
ConcreteImplementorA Operation
ConcreteImplementorB Operation |
| [+] | Achieve Flexible Data Modeling With The Entity Framework |
| [+] | Software development methodologies and system analysis |
| [+] | C++ Software |
| [+] | Java (J2EE) provides a scalable and robust framework for Enterprise application development Java .. |
| [+] | Microsoft DLR (Dynamic Language Runtime) information released |
| [+] | More news on Java OpenSource initiative |
| [+] | Programming - Mediator Behavioral Design Pattern |
| [+] | Protocol Buffers - Google's Data Interchange Format |
| [+] | Software languages and development platforms |
| [+] | Hibernate |
