private void button1_Click(object sender, EventArgs e)
        {
            Cat cat = new Cat("小咪");

            cat.ShoutNum = 5;
            MessageBox.Show(cat.Shout());
        }
Exemple #2
0
        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();
        }
Exemple #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     Animal cat = new Cat("小咪");
     cat.ShoutNum = 5;
     MessageBox.Show(cat.Shout());
 }
Exemple #4
0
        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();
        }