/**
 * Abstract Factory is a creational design pattern that produces
 * families of related objects without specifying their concrete
 * classes.
 */ interface AbstractFactory { createProductA ( ) : AbstractProductA ; createProductB ( ) : AbstractProductB ; } export class ConcreteFactory1 implements AbstractFactory { createProductA ( ) { return new ConcreteProductA1 ( ) ; } createProductB ( ) { return new ConcreteProductB1 ( ) ; } } export class ConcreteFactory2 implements AbstractFactory { createProductA ( ) { return new ConcreteProductA2 ( ) ; } createProductB ( ) { return new ConcreteProductB2 ( ) ; } } interface AbstractProductA { operationA ( ) : string ; } interface AbstractProductB { operationB ( ) : string ; } export class ConcreteProductA1 implements AbstractProductA { operationA ( ) { return 'ConcreteProductA1' ; } } export class ConcreteProductA2 implements AbstractProductA { operationA ( ) { return 'ConcreteProductA2' ; } } export class ConcreteProductB1 implements AbstractProductB { operationB ( ) { return 'ConcreteProductB1' ; } } export class ConcreteProductB2 implements AbstractProductB { operationB ( ) { return 'ConcreteProductB2' ; } }