Esempio n. 1
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;
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            CatHouse cats = new CatHouse();

            Cat c1 = new Cat("mestan1", 1, "woman", 10, 10, 3);

            cats.AddCat(ref c1);
            Cat c2 = new Cat("mestan2", 4, "woman", 20, 5, 5);

            cats.AddCat(ref c2);
            cats.ShowCats();



            for (int i = 0; i < 10; i++)

            {
                c1.Play();

                c2.Play();
            }

            for (int i = 0; i < 10; i++)

            {
                c1.Sleep();

                c2.Sleep();
            }

            for (int i = 0; i < 10; i++)

            {
                c1.Play();

                c2.Play();
            }
            PetShop ps = new PetShop();

            ps.AddCatHouse(ref cats);
            ps.ShowHouses();
        }