Design Pattern -Factory

In Modern programming language the factory design pattern is probable the mostly used in differnt varient and implementations.This type of design pattern come under creational pattern as this pattern provides one of best ways to create an object.
Factory design pattern is used when we have a super class with multiople sub-classes and based on input ,we need to return one of the sub-class.Factory design pattern takeout the responsibility of instantiation of a class from client program to the factory class.
We can apply Singleton on factory class or make the factory method static ,see in bellow example.


Design Pattern

1 comment:

Unknown said...

Hi Suryaprakash,

Thanks a lot for the appreciation. Glad the article helped :)

Reply