static void Main(string[] args) { var normalDuck = new Duck(new FlyWithWings(), new Quack()); normalDuck.PerformFly(); normalDuck.PerformQuack(); var rubberDuck = new Duck(new FlyNoWay(), new Squeak()); rubberDuck.PerformFly(); rubberDuck.PerformQuack(); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Welcome to the SimUDuck Simulator."); Console.WriteLine("Please select the duck:\n" + "1. Mallard Duck.\n" + "2. Redhead Duck.\n" + "3. Decoy Duck.\n" + "4. Rubber Dock.\n"); var duckType = Convert.ToInt32(Console.ReadLine()); Duck duck = GetDuckByItsType(duckType); if (duck != null) { duck.PerformFlyBehavior(); duck.PerformQuackBehavior(); } Console.WriteLine("Thanks for using SimUDuck Simulator. We wish you a good day."); }