using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
boss bon = new boss();
employ emp = new employ();
employ1 emp1 = new employ1();
bon.myEvent += new boss.myDle(emp.sayHello);
bon.myEvent += new boss.myDle(emp1.sayHello);
bon.content = "我来了";
bon.notify();
Console.WriteLine("hello");
Console.ReadKey();
}
}
class boss
{
public string content;
public delegate void myDle(string str);
public event myDle myEvent;
public void notify()
{
if (myEvent!=null)
{
myEvent(content);
}
}
}
class employ
{
public void sayHello(string test)
{
Console.WriteLine("A"+ test);
}
}
class employ1
{
public void sayHello(string test)
{
Console.WriteLine("B"+ test);
}
}
}