Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

《设计模式手册》中装饰器模式(第7章)示例代码有误 #111

Open
zzzzfly opened this issue Jun 3, 2024 · 0 comments
Open

Comments

@zzzzfly
Copy link

zzzzfly commented Jun 3, 2024

  1. 定义了抽象类Food,Food中抽象方法为getDesc()
  2. 定义了两个食物类继承了Food,但两个食物类重写的抽象方法为cook()
    如图所示:
    2024-06-03_10-04
  3. 定义了装饰的抽象类FoodDecoration,继承Food。再定义两个不同的装饰类继承FoodDecoration,但只实现了FoodDecoration中的抽象方法,没有实现Food的抽象方法。如图所示:
    2024-06-03_10-08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant