예제 #1
0
        static void Main(string[] args)
        {
            //creating object of white duck
            Duck d = new WhiteDuck();

            d.Fly();
            d.Fb = new FlySlow();

            d.Quack();
            d.Fly();

            //creating object of red duck
            d = new RedDuck();
            d.Fly();
            d.Quack();

            //creating object of rubber duck
            d = new RubberDuck();
            d.Fly();
            d.Quack();

            //creating object of wooden duck
            d = new WoodenDuck();
            d.Fly();
            d.Quack();



            Console.ReadKey();
        }
예제 #2
0
        private static void Main()
        {
            WhiteDuck whiteDuck = new WhiteDuck();

            whiteDuck.Quack();

            BlackRaven   blackRaven   = new BlackRaven();
            RavenAdapter ravenAdapter = new RavenAdapter(blackRaven);

            ravenAdapter.Quack();
        }