using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
猫 mao = new 猫();
老鼠 laosu = new 老鼠();
主人 zhuren = new 主人();
mao.事件 +=new 猫.delgate(laosu.老鼠跑);
mao.事件 += new 猫.delgate(zhuren.吵死了);
mao.猫叫();
Console.WriteLine();
}
}
}
public class 猫
{
public delegate void delgate(); //猫叫委托
public event delgate 事件; //事件
public void 猫叫() //猫叫的方法
{
Console.WriteLine("有老鼠,往哪里跑,喵喵~");
if (事件 != null)
{
事件();
}
}
}
public class 老鼠
{
public void 老鼠跑() //老鼠跑的方法
{
Console.WriteLine("啊!有猫快跑");
}
}
public class 主人
{
public void 吵死了() //主人被吵醒了
{
Console.WriteLine("吵死了!");
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
猫 mao = new 猫();
老鼠 laosu = new 老鼠();
主人 zhuren = new 主人();
mao.事件 +=new 猫.delgate(laosu.老鼠跑);
mao.事件 += new 猫.delgate(zhuren.吵死了);
mao.猫叫();
Console.WriteLine();
}
}
}
public class 猫
{
public delegate void delgate(); //猫叫委托
public event delgate 事件; //事件
public void 猫叫() //猫叫的方法
{
Console.WriteLine("有老鼠,往哪里跑,喵喵~");
if (事件 != null)
{
事件();
}
}
}
public class 老鼠
{
public void 老鼠跑() //老鼠跑的方法
{
Console.WriteLine("啊!有猫快跑");
}
}
public class 主人
{
public void 吵死了() //主人被吵醒了
{
Console.WriteLine("吵死了!");
}
}
338

被折叠的 条评论
为什么被折叠?



