Пример #1
0
        static void Main(string[] args)
        {
            Grandfather grandfather = new Grandfather();
            Grandmother grandmother = new Grandmother();
            Bun         bun         = new Bun();

            Animal[] animals = { new Hare(), new Wolf(), new Bear(), new Fox() };
            Meet     meeting;
            Fox      fox = (Fox)animals[3];

            Console.WriteLine("Жил-был старик со старухою. Просит старик:");
            grandfather.Speak();
            grandmother.Speak();
            grandfather.FindSolution();
            grandmother.FindFlour();
            grandmother.BakeBun();
            bun.RunAway();
            for (int i = 0; i < animals.Length; i++)
            {
                bun.Run();
                meeting = new Meet(bun, animals[i]);
                meeting.MeetAnimal();
            }
            fox.FindSolution();
            bun.Sing(Meet.CountMeet);
            fox.FindSolution();
        }
Пример #2
0
 public void MeetAnimal()
 {
     Console.WriteLine("Катится колобок по дороге, а навстречу ему {0}:", animal.Name);
     animal.Speak();
     Console.WriteLine("Не ешь меня, {0}! Я тебе песенку спою:", animal.Name);
     bun.Sing(countMeet);
     Console.WriteLine("От тебя, {0}, не хитро уйти!", animal.Name);
     countMeet++;
 }