interface IFruitFactory{
puhlic Fruit getFruit();
}
class AppleFactory implements IFruitFactory{
public Fruit getFruit(){
//生产苹果
return new Apple();
}
}
Client:
IFruitFactory factory = new AppleFactory();
Fruit fruit = new factory.getFruit();