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 use case in clean architecture?
What is the difference between architecture and design?
Why is singleton bad?
Shall we use abstract classes or interfaces in policy / strategy design pattern?
What is the difference between factory and builder design pattern?
What non-visual coding tools are available for web design?
What are the types of participants of the prototype design pattern you will get?
What is the builder pattern?
What is the gang of four design pattern?
What is clean architecture?
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?
What are the design patterns you know explain?
Can we make the reference instance non static?
Give me example of observer design pattern?
What is the difference between adapter and facade?