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 meant by multiple inheritance?
What is the difference between abstraction and polymorphism?
What is polymorphism explain its types?
Why multiple inheritance is not allowed?
Why oops is important?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What are the benefits of interface?
Can we create object of abstract class?
Can an interface inherit a class?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is data binding in oops?
What do you mean by Encapsulation?
What is the point of oop?
What are the types of abstraction?
What polymorphism means?