示例#1
0
        static void Main(string[] args)
        {
            Cat c1 = new Cat("Kitty", 2, "Female", 10);
            Cat c2 = new Cat("Bob", 3, "Male", 5);

            c1.Show();
            for (int i = 0; i < 10; i++)
            {
                c1.Play();
                c2.Play();
            }
            //c1.Show();
            c1.Sleep();
            //c1.Show();
            c1.Eat();
            //c1.Show();

            CatHouse ch1 = new CatHouse();

            ch1.AddCat(ref c1);
            ch1.AddCat(ref c2);
            ch1.ShowCats();
            PetShop ps1 = new PetShop("PetSHOP");

            ps1.AddCatHouse(ref ch1);
            ps1.CalculateTotalMealQuantity();
            ps1.CalculateTotalPrice();
            ps1.Show();
        }
示例#2
0
 public void AddCatHouse(ref CatHouse catHouse)
 {
     CatHouse[] temp = new CatHouse[++CatHouseCount];
     if (CatHouses != null)
     {
         CatHouses.CopyTo(temp, 0);
     }
     temp[temp.Length - 1] = catHouse;
     CatHouses             = temp;
 }