static void Main(string[] args) { //A celebrity Celebrity tomCruise = new Celebrity(); //some fans HappyFan fan1 = new HappyFan(); HappyFan fan2 = new HappyFan(); SadFan fan3 = new SadFan(); SadFan fan4 = new SadFan(); //fans registering against an event in celebrity life so that they can be notified when that event occurs fan1.Register(tomCruise); fan2.Register(tomCruise); fan3.Register(tomCruise); fan4.Register(tomCruise); //triggering the event tomCruise.Suicide(); }
public void Register(Celebrity c) { c.fansToNotify += Weep; }
public void Register(Celebrity c) { c.fansToNotify += Laugh; }