Differences between Abstract Factory Pattern and Factory Method,confused by one case -


the main difference between "factory method" , "abstract factory" factory method single method, , abstract factory object. but, can't is,for example

class product{  } interface facotory{     public product create(); }  class factorya implements facotory{ public product create() {     return null; }    }  class factoryb implements facotory{     public product create() {     return null;     } } 

can tell me factory method or abstract factory?thank you!

imo, current example above factory method.

as have defined interface (factory) factory method (create) allows sub classes (factorya , factoryb) decide class instantiate (product derived classes).


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -