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.
Watch video Factory Method Design Pattern - C# | Factory vs Factory Method | Creational Design Pattern | Part-3 online without registration, duration hours minute second in high quality. This video was added by user Code with Salman 17 April 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 89 once and liked it 1 people.