implemented factory pattern

This commit is contained in:
ismayilmalik 2018-01-02 22:11:03 +03:00
parent 82090ab827
commit e147dcd8f8

View File

@ -10,6 +10,7 @@
- [Creational patterns](#creational-patterns) - [Creational patterns](#creational-patterns)
- [Singleton](#singleton) - [Singleton](#singleton)
- [Builder](#builder) - [Builder](#builder)
- [Factory](#factory)
- [Structural patterns](#structural-patterns) - [Structural patterns](#structural-patterns)
- [Composition](#composition) - [Composition](#composition)
- [Behavioral patterns](#behavioral-patterns) - [Behavioral patterns](#behavioral-patterns)
@ -29,6 +30,10 @@ Ensure a class only has one instance, and provide a global point of access to it
Separate the construction of a complex object from its representation so that the Separate the construction of a complex object from its representation so that the
same construction process can create different representations. same construction process can create different representations.
### Factory
Define an interface for creating an object, but let subclasses decide which class to
instantiate. Factory Method lets a class defer instantiation to subclasses.
## Structural patterns ## Structural patterns
Structural patterns are concerned with how classes and objects are composed to form Structural patterns are concerned with how classes and objects are composed to form
larger structures. Structural class patterns use inheritance to compose interfaces or implementations. larger structures. Structural class patterns use inheritance to compose interfaces or implementations.