private void button1_Click(object sender, EventArgs e) { Animal cat = AnimalFactory.CreateAnimal("猫", "小花", 5); MessageBox.Show(cat.Shout()); }
private void button2_Click(object sender, EventArgs e) { Animal dog = AnimalFactory.CreateAnimal("狗", "旺财", 3); MessageBox.Show(dog.Shout()); }
private void button5_Click(object sender, EventArgs e) { arrayAnimal.Add(AnimalFactory.CreateAnimal(listBox1.SelectedItem.ToString(), "小" + listBox1.SelectedItem.ToString(), 3)); }