In C#… factory design pattern, why all “factory class” should be inherited from “abstract factory class” ??
Without inheriting also we can achieve same functionality. Cant we?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Factories that inherit from an abstract factory class are doing so to follow the abstract factory pattern. The abstract factory pattern is useful when you want to create a strategy out of whole groups of object types. For this reason it is also called the “kit” pattern.
Often, factories are perfectly viable without an abstraction. If you don’t need one now, leave it alone. You can always make an abstract factory later, if it is needed.
Some more reading:
http://en.wikipedia.org/wiki/Abstract_factory_pattern