I am implementing factory design pattern in java where I want to keep one overloaded method in abstract class. Will it violate the factory pattern concept? Or please suggest whether this is right way to implement Factory design pattern ?
abstract class A{
meth(int a);
meth(int a,int b);
}
class Factory{
factoryMethod(int a){
if(a==1){
return new Ob1();
}
else{
return new Ob2();
}
}
}
class Ob1 extends A{
meth(int a){}
meth(int a,int b){}
}
Aucun commentaire:
Enregistrer un commentaire