16 观察者模式/Program.cs
(完整代码) 856Busing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 观察者模式
{
//以微信订阅号的例子,一个是腾讯游戏订阅号类(主题,被观察者),另一个是订阅者类。
//订阅号类中必须引用一个订阅者对象,这样才能在订阅号状态改变时,
//调用这个订阅者对象的方法来通知到订阅者对象。
class Program
{
static void Main(string[] args)
{
TenXun tenxun = new TenXunGame("腾讯游戏", "新游戏");
//添加订阅者
tenxun.AddObserver(new Subscriber("huy"));
tenxun.AddObserver(new Subscriber("zxl"));
tenxun.Notify();
Console.ReadLine();
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。