public static void Main(string[] args) { Console.WriteLine("Current News is : Dummy Text"); NewsAgency myAgency = new NewsAgency(); SMSService sms = new SMSService(); EmailService email = new EmailService(); myAgency.AddObserver=sms; myAgency.AddObserver=email; myAgency.Add="shantonu is coading"; myAgency.notifyAllOvservers("shantonu is coading"); Console.ReadLine(); }
public static void Main(string[] args) { Console.WriteLine("Current News is : Dummy Text"); NewsAgency myAgency = new NewsAgency(); SMSService sms = new SMSService(); EmailService email = new EmailService(); myAgency.AddObserver = sms; myAgency.AddObserver = email; myAgency.Add = "shantonu is coading"; myAgency.notifyAllOvservers("shantonu is coading"); Console.ReadLine(); }
static void Main(string[] args) { WeatherStation weatherStation = new WeatherStation(); NewsAgency agency1 = new NewsAgency("Alpha"); NewsAgency agency2 = new NewsAgency("Beta"); NewsAgency agency3 = new NewsAgency("Gamma"); NewsAgency agency4 = new NewsAgency("Delta"); weatherStation.Attach(agency1); weatherStation.Attach(agency2); weatherStation.Attach(agency3); weatherStation.Attach(agency4); weatherStation.Temperature = 22.1f; weatherStation.Temperature = 37.5f; weatherStation.Temperature = 49.4f; weatherStation.Temperature = 0.4f; }
static void Main(string[] args) { WeatherStation weatherStation = new WeatherStation(); NewsAgency agency1 = new NewsAgency("Best News Agency"); weatherStation.Attach(agency1); NewsAgency agency2 = new NewsAgency("Fake News Agency"); weatherStation.Attach(agency2); NewsAgency agency3 = new NewsAgency("Yellow Press Agency"); weatherStation.Attach(agency3); weatherStation.Temp = 18.4f; weatherStation.Temp = 25.6f; weatherStation.Temp = 31.4f; weatherStation.Temp = 14.4f; weatherStation.Temp = 29.6f; Console.ReadKey(); }