Complete PlayList:
• Design Pattern in C# Complete PlayLis...
What is Factory Method Design Pattern?
According to Gang of Four Definition “Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation it uses to subclasses”.
Let us simplify the above definition. The Factory Method Design Pattern is used, when we need to create the object (i.e. instance of the Product class) without exposing the object creation logic to the client. To achieve this, in the factory method design pattern we will create an abstract class as the Factory class which will create and return the instance of the product, but it will let the subclasses decide which class to instantiate
In Factory pattern, we create the object without exposing the creation logic. In this pattern, an interface is used for creating an object, but let subclass decide which class to instantiate. The creation of object is done when it is required. The Factory method allows a class later instantiation to subclasses.
In short, factory method design pattern abstract the process of object creation and allows the object to be created at run-time when it is required.
Смотрите видео Factory Method Design Pattern - C# | Factory vs Factory Method | Creational Design Pattern | Part-3 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code with Salman 17 Апрель 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 89 раз и оно понравилось 1 людям.