观察者模式

46 阅读1分钟
观察者模式最重要两个核心代码
1.subject对象和observer对象互相知道
2.subject状态改变通知所有observer

image.png

image.png

image.png