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
What is the behavioral design pattern?
Is oop a design pattern?
What is the difference between adapter and facade?
Why is singleton used?
What is the concurrency design pattern?
What is the gang of four design pattern?
Is singleton an anti pattern?
What are the main usage of the patterns?
What is the difference between proxy and adapter?
Did you use ooa/ood methodologies? Did you use design patterns?
What are the languages used in the design pattern?
Which design pattern is mostly used in net?
what are the creational design patterns
What are the most important software design patterns?
What are the most popular design patterns?