private void button1_Click(object sender, EventArgs e) { Cat cat = new Cat("小咪"); cat.ShoutNum = 5; MessageBox.Show(cat.Shout()); }
static void Main(string[] args) { Cat cat = new Cat("Tom"); Mouse mouse1 = new Mouse("Jerry"); Mouse mouse2 = new Mouse("Jack"); cat.CatShout += new Cat.CatShoutEventHandler(mouse1.Run); cat.CatShout += new Cat.CatShoutEventHandler(mouse2.Run); cat.Shout(); Console.Read(); }
private void button1_Click(object sender, EventArgs e) { Animal cat = new Cat("小咪"); cat.ShoutNum = 5; MessageBox.Show(cat.Shout()); }