Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


In what situation factory design patterns,DAO design
patterns,singleton design patterns should be applied.?

Answers were Sorted based on User's Feedback



In what situation factory design patterns,DAO design patterns,singleton design patterns should be a..

Answer / 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

In what situation factory design patterns,DAO design patterns,singleton design patterns should be a..

Answer / monica

Use Factory Design Pattern when
- a class cannot anticipate the class of objects it must
create
- a class wants its subclasses to specify the objects it
creates
- classes delegate the responsibility to one of several
helper subclasses and you want to knowledge of which helper
subclass is the delegate.

Use Singleton Pattern when
- there must be one instance of a class and it must be
accessible to clients from well known access point.
-the sole instance should be extensible by subclassing, and
client should be able to use an extended instance without
modifying their code.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

How do you define a class in oop?

0 Answers  


write a C++ program for booking using constructor and destructor.

0 Answers   HAL,


Who invented oop?

0 Answers  


The type of variable a pointer points to must be the part of pointer's definition so that:

1 Answers   Infosys,


Why do we use polymorphism in oops?

0 Answers  


design class for linked list and include constructor,destructor,insert option. struct node { int node; struct node &ptr; }

1 Answers   HSBC,


What is a class and object?

0 Answers  


what is the difference between class and object?

9 Answers  


What is an interface in oop?

0 Answers  


what is mean by design pattern

4 Answers  


What type of loop is a for loop?

0 Answers  


What is command routing in MFC

1 Answers   GE,


Categories