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

Explain three types of components comprise an application design?

1022


What is the difference between adapter and facade?

1210


What are the additional productivity features and enhancements included with Quartus II software version 6.0?

2371


What is the use of such a class?

1275


What is the use of design patterns?

1137


Are you using singleton in your code?

1160


Is mvc a software design pattern?

1134


Did you use ooa/ood methodologies? Did you use design patterns?

1080


Why is singleton used?

1077


Give me example of observer design pattern?

1111


Explain what is good design?

1060


What is architecture and what is design?

1112


What is clean architecture?

991


What are the examples of the behavioral design patterns?

1129


What is single tone design pattern in java?

1042