/* BAD
         * You don't want to add methods to the super class.
         * You need to separate what is different between subclasses
         * and the super class
         * public void fly(){
         *
         *      System.out.println("I'm flying");
         *
         * }
         */

        // Animal pushes off the responsibility for flying to flyingType

        public String TryToFly()
        {
            return(flyingType.Fly());
        }
Пример #2
0
 public void IsFlying()
 {
     Console.WriteLine($"{Name} {FlyingType.Fly()}");
 }