观察者模式

C++中的观察者设计模式实现

2024-07-15 1 分钟阅读

观察者模式

{% hint style=“info” %}
观察者模式的核心思想:一对多
{% endhint %}

传统写法

简单观察者

使用智能指针

unique_ptr

shared_ptr