using System;
namespace lesson2
{
public class Student{
public string name;
public Student(string name){
this.name =name;
}
public void ReceiveMessage(string s){
Console.WriteLine (name+s);
}
}
public class monitor {
public delegate void WakeUp(string s);
public event WakeUp w;
public void inform (string s){
w(s);
}
}
public class Test0{
public static void Main(){
Student s1 =new Student ("A");
Student s2 =new Student ("B");
monitor m = new monitor ();
m.w+=s1.ReceiveMessage ;
m.w += s2.ReceiveMessage;
m.inform ("老师来啦!");
}
}
}
namespace lesson2
{
public class Student{
public string name;
public Student(string name){
this.name =name;
}
public void ReceiveMessage(string s){
Console.WriteLine (name+s);
}
}
public class monitor {
public delegate void WakeUp(string s);
public event WakeUp w;
public void inform (string s){
w(s);
}
}
public class Test0{
public static void Main(){
Student s1 =new Student ("A");
Student s2 =new Student ("B");
monitor m = new monitor ();
m.w+=s1.ReceiveMessage ;
m.w += s2.ReceiveMessage;
m.inform ("老师来啦!");
}
}
}