/**
 * Bridge is a structural design pattern that splits
 * a large class or a set of closely related classes
 * into two separate hierarchies—abstraction and
 * implementation—which can be developed independently
 * of each other.
 */ interface Implementation { operation ( ) : string ; } export class Abstraction { protected implementation : Implementation ; constructor ( implementation ) { this . implementation = implementation ; } public operation ( ) { const result = this . implementation . operation ( ) ; return `Abstraction: Base operation with ${ result }` ; } } export class ExtendedAbstraction extends Abstraction { public operation ( ) { const result = this . implementation . operation ( ) ; return `Abstraction: Extended operation with ${ result }` ; } } export class ConcreteImplementationA implements Implementation { public operation ( ) { return 'ConcreteImplementationA' ; } } export class ConcreteImplementationB implements Implementation { public operation ( ) { return 'ConcreteImplementationB' ; } }