0
Factory design pattern advantages
Hello I am aware that factory design patterns help us to create a method to create objects... I could not understand how client code is not required to change and all similar terms for this design pattern.... can anyone please help me to understand this in detail?
4 odpowiedzi
0
Refer below link :
https://www.geeksforgeeks.org/design-patterns-set-2-factory-method/
Here in both the way, hard-coding is already there.... in first approach, class constructor is having code to decide object type where as in factory design patterns, class static method decided object type....
if I am codder, what could be differentiated for me to change in class constructor or class method... code change is required at all in case of new addition of object type.... what benifit I could get by defining objects type instantiation into a class method...
0
any thoughts on the same ?
0
shubham kumar plz don't spam... Is this code relevant to the question , if not don't post it here