抽象工厂模式
2020-05-22 14:10:39 0 举报
抽象工厂模式
作者其他创作
大纲/内容
PcFactory pc = new ApplePcFactory();Mouse m = pc.createMouse();KeyBoard kb = pc.createKeyBoard();m.sayHello();kb.sayHello();
KeyBoard
+ sayHello()
AppleKeyBoard
+ sayHello(){\"AppleKeyBoard\"}
DellKeyBoard
+ sayHello(){\"DellKeyBoard\"}
DellMouse
+ sayHello(){\"DellMouse\"}
ApplePcFactory
+ Mouse createMouse(){return AppleMouse}+ KeyBoard createKeyBoard(){return AppleKeyBoard}
AppleMouse
+ sayHello(){\"AppleMouse\"}
抽象工厂模式
Mouse
PcFactory
+ Mouse createMouse()+ KeyBoard createKeyBoard()
DellPcFactory
+ Mouse createMouse(){return DellMouse}+ KeyBoard createKeyBoard(){return DellKeyBoard}
0 条评论
下一页