Example #1
0
        static void Main(string[] args)
        {
            Pet    thisPet;
            Dog    dog  = new Dog();
            Cat    cat  = new Cat();
            IDog   iDog = new IDog();
            ICat   iCat = new ICat();
            Pets   pets = new Pets();
            Random rand = new Random();

            for (int x = 0; x > 51; x++)
            {
                if (rand.Next(1, 11) == 1)
                {
                    // 50% chance of adding a dog
                    if (rand.Next(0, 2) == 0)
                    {
                        dog.Add(dog);
                    }
                    else
                    {
                        // else add a cat
                        cat.Add(cat);
                    }
                }
                else
                {
                    thisPet = pets.petList;
                }
            }
        }