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

What are the most important software design patterns?

1183


Why have we used synchronized here?

1030


What is meant by design pattern?

1050


What design pattern wrapper classes implement?

1036


Why have we declared the instance reference volatile?

1016


What is the difference between 3 tier and n tier architecture?

1077


What is the singleton design pattern?

1067


Contact a small, medium, and a large contract program within your organization. Interview the Technical Director or Project Engineer to identify the following information: a. Request the individual to graphically depict their development strategy? b. What factors drove them to choose the implementation strategy? c. What were some of the lessons learned from developing and implementing the strategy that would influence their approach next time? d. How was the V & V strategy implemented?

2862


Can we use an equated value as operands for an MVC ? Reason for the same.

2453


What is single tone design pattern in java?

1068


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

2837


Which design pattern is mostly used in net?

1125


What is factory method in design pattern?

1056


what is the lazy design pattern?

1062


Is mvc is a design pattern?

1108