static void Main(string[] args) { Cat cat = new Cat("kafei" ,"yellow"); Mouse mouse1 = new Mouse("miki","white",cat); //cat.catCome += mouse1.RunAway; Mouse mouse2 = new Mouse("kili","black",cat); //cat.catCome += mouse2.RunAway; //cat.CatComing(mouse1,mouse2); cat.CatComing(); Console.ReadKey(); }
public Mouse(string name, string color,Cat cat) { this.name = name; this.color = color; cat.catCome += this.RunAway; }