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
Can we inherit singleton class?
5.Develop an entity relationships diagram that identifies physical entity relationships.
What is difference between function oriented design and object oriented design?
What are the design patterns you know explain?
Why have we declared the instance reference volatile?
What is the difference between factory and abstract factory design pattern?
What are the languages used in the design pattern?
What are the types of design patterns?
Why singleton beans are not thread safe?
What is architecture and what is design?
What is the design pattern?
What is the singleton design pattern?
Why do we need singleton pattern?
What is the gang of four design pattern?
4. Identify and bound the SOI’s Operating Environment.