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
Explain three types of components comprise an application design?
What is the difference between adapter and facade?
What are the additional productivity features and enhancements included with Quartus II software version 6.0?
What is the use of such a class?
What is the use of design patterns?
Are you using singleton in your code?
Is mvc a software design pattern?
Did you use ooa/ood methodologies? Did you use design patterns?
Why is singleton used?
Give me example of observer design pattern?
Explain what is good design?
What is architecture and what is design?
What is clean architecture?
What are the examples of the behavioral design patterns?
What is single tone design pattern in java?