真题详解(索引长度计算)-软件设计(七十一)https://blog.csdn.net/ke1ying/article/details/130590260
- 外观模式
解析:
- public String getName()
- public void dispose(Patient patient)
- new ConcreteOatient(“name”)
- Facade
- new Facade(patient)
- f.dispose()
- 装饰模式
- tickect.printInvoice()
- super.printInvoice()
- super.printInvoice()
- new HeadDecorator(new FootDecorator(t))
- new HeadDecorator(new FootDecorator(null))
- 策略模式
解析:
- double acceptCash(double money)
- cs = new CashNormal()
- cs = new CashDiscount(0.8)
- cs =new CashReturn(300,100)
- Return cs.acceptCash(money)