Explain Factory pattern?

Answers were Sorted based on User's Feedback



Explain Factory pattern?..

Answer / swetha

Factory Design Pattern is a simple decision making class
that returns one of several objects depending on the data
provided. It comes under creational type of design pattern.


Example:

Suppose say that want to write the code to perform
arithmetic calculations. Initially you decided to write code
for only Addition and Subtraction. And later on you decided
to add more functionality by including Multiplication and
Division. Now, if you don't use Factory Design Pattern, we
need to change the entire code to include additional
functionality. But, when we use Factory Design Pattern, It
is easy to add additional functionality when needed without
disturbing previous code.

In factory class we create the instance of the classes
addition, subtraction, division and multiplication based on
the operator selected.

In this way Factory Design Pattern is useful.

Is This Answer Correct ?    4 Yes 0 No

Explain Factory pattern?..

Answer / gaurav

For better answer :
http://planetofcoders.blogspot.com/2011/10/can-you-explain-factory-pattern.html

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

How many types of controls are there in asp.net?

0 Answers  


Why will you usually create an aspnet user account in the database for an asp.net web application?

0 Answers  


How can we prepairing Interview

0 Answers   ITcom, TCS,


What is http post and http get?

0 Answers  


Describe the difference between a Thread and a Process?

4 Answers  


What is synchronous and Asynchronous post back ?

0 Answers  


how to transfer the file from client to server using asp.net

0 Answers   Sans Pareil IT Services,


From which base class all web forms are inherited?

0 Answers  


What is asp net application object?

0 Answers  


When do you set "<IDENTITY impersonate="true" />" ?

1 Answers  


Please brief not about xsd,xslt & xml?

0 Answers  


Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

3 Answers   HCL, Wipro,


Categories