示例#1
0
    public void CreatePet(string[] args)
    {
        string name = args[2];
        int    age  = int.Parse(args[3]);
        string kind = args[4];
        Pet    pet  = petFactory.Create(name, age, kind);

        pets.Add(pet);
    }
示例#2
0
    static void Main()
    {
        IPet cat = PetFactory.Create("cat");

        cat.Show();
    }