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 / md. nasim ahmed

The conventional polymorphism approach can also be used to reach the desired result of handling different class object with same set of methods. But the problem is the driver (main/module) must handle the creation of type of object.
CBase *bptr=new CChild();
bptr->method1();
----
The Factory design pattern ease the programming effort to write the driver program as the creation of object is handled by base class only(factory class).
CBase *bptr= CBase::make_object(chioce);

----
Now refer http://sourcemaking.com/design_patterns/factory_method/cpp/1

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we inherit singleton class?

1047


5.Develop an entity relationships diagram that identifies physical entity relationships.

2783


What is difference between function oriented design and object oriented design?

1025


What are the design patterns you know explain?

1054


Why have we declared the instance reference volatile?

937


What is the difference between factory and abstract factory design pattern?

946


What are the languages used in the design pattern?

993


What are the types of design patterns?

1100


Why singleton beans are not thread safe?

1020


What is architecture and what is design?

1054


What is the design pattern?

1020


What is the singleton design pattern?

996


Why do we need singleton pattern?

959


What is the gang of four design pattern?

1029


4. Identify and bound the SOI’s Operating Environment.

3730