In what situation factory design patterns,DAO design
patterns,singleton design patterns should be applied.?
Answer Posted / rajan
Unlike constructors, factory methods are not required to
create a new object each time they are invoked. Factory
methods can encapsulate the logic required to return a
singleton instance of the class requested, or they can
return an instance of the requested class from a pool of
instances.
Factory methods can return any subtype of the type
requested, and can require that clients refer to the
returned object by its interface, rather than the
implementation class. This enables an API to return objects
without making their classes public.
The class for the object returned by a factory method need
not even exist at the time the factory method is written.
This is one of the classic benefits of polymorphism: "old
code uses new code," which means that new classes can be
added, and their instances returned by the factory method,
without changing any of the existing code.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is difference between data abstraction and encapsulation?
What is abstraction oop?
Plese get me a perfect C++ program for railway/airway reservation with all details.
Describe these concepts: Polymorphism, Inheritance and Abstraction.
What is the difference between a constructor and a destructor?
What is polymorphism explain?
How do you achieve runtime polymorphism?
How is polymorphism achieved?
What polymorphism means?
Why do we need oop?
Is abstract thinking intelligence?
What is polymorphism programming?
What is data binding in oops?
what's the basic's in dot net
Why is abstraction needed?