Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

When to Use a Factory Pattern?

Answer Posted / guest

A class can?t anticipate which kind of class of objects it
must create.
A class uses its subclasses to specify which objects it creates.
You want to localize the knowledge of which class gets created.


There are several similar variations on the factory pattern
to recognize.
1. The base class is abstract and the pattern must return a
complete working class.
2. The base class contains default methods and is only
subclassed for cases where the default methods are insufficient.
3. Parameters are passed to the factory telling it which of
several class types to return. In this case the classes may
share the same method names but may do something quite
different.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between adapter and facade?

1146


Can you explain singleton pattern?

992


What are the disadvantages of singleton pattern?

1052


What are creational design patterns?

1021


What is the use of design patterns?

1065


What is the behavioral design pattern?

1076


Give me example of chain of responsibility design pattern?

998


What are the 23 design patterns?

1108


What is the difference between builder and composite?

1086


What is the design pattern?

1020


Shall we use abstract classes or interfaces in policy / strategy design pattern?

1037


What is use case in clean architecture?

1039


What are the most important software design patterns?

1105


Why is singleton bad?

964


What is synchronizer token pattern?

1036