Пример #1
0
 public void Speaks(Goat Billy, Ox Jerry, Pig Tim, Sheep Sherry)
 {
     Console.WriteLine($"{Billy.Name()}, {Billy.Speaks()}, {Billy.Eat()}, {Billy.Provide()}");
     Console.WriteLine($"{Jerry.Name()}, {Jerry.Speaks()}, {Jerry.Eat()}, {Jerry.Provide()}");
     Console.WriteLine($"{Tim.Name()}, {Tim.Speaks()}, {Tim.Eat()}, {Tim.Provide()}");
     Console.WriteLine($"{Sherry.Name()}, {Sherry.Speaks()}, {Sherry.Eat()}, {Sherry.Provide()}");
 }
Пример #2
0
        static void Main(string[] args)
        {
            Farm newFarm = new Farm();

            Console.WriteLine("Welcome to Earl's Farm, here are some of our animals.");
            Goat  Billy  = new Goat("I'm Billy", "I say Baahhh", "I eat grass", "I provide milk");
            Ox    Jerry  = new Ox("I'm Jerry", "I say HOOOOOGGHH", "I also eat grass", "I help move heavy things");
            Pig   Tim    = new Pig("I'm Tim", "I say Oink", "I eat just about anything", "I provide bacon");
            Sheep Sherry = new Sheep("I'm Sherry", "I say Baaahh", "I eat grass", "I provide wool");

            newFarm.Speaks(Billy, Jerry, Tim, Sherry);
        }