A templates of the Observer class. | Lecture 5 - slide 42 : 45 Program 2 |
using System.Collections; namespace Templates.Observer { public class Observer { private Subject mySubject; public Observer (Subject s){ mySubject = s; } public void Update(){ SubjectState state = mySubject.GetState(); // if (the state is interesting){ // react on state change // } } } } |