예제 #1
0
        static void Main(string[] args)
        {
            BaseballPlayer dude      = new BaseballPlayer();
            WoodenBat      woodenBat = new WoodenBat();
            AluminumBat    alum      = new AluminumBat();

            dude.TakeTurn(woodenBat);
            dude.TakeTurn(alum);
        }
예제 #2
0
        static void Main(string[] args)
        {
            var     woodenBat    = new WoodenBat();
            var     aluminumBat  = new AluminumBat();
            var     compositeBat = new CompositeBat();
            var     hank         = new BaseballPlayer();
            IPlayer tom          = new CricketPlayer();

            tom = new BaseballPlayer();

            hank.TakeTurn(woodenBat);
            hank.TakeTurn(aluminumBat);
            hank.TakeTurn(compositeBat);

            tom.TakeTurn(woodenBat);
            tom.TakeTurn(aluminumBat);
            tom.TakeTurn(compositeBat);
        }
예제 #3
0
        static void Main(string[] args)
        {
            BaseballPlayer hank         = new BaseballPlayer();
            CricketPlayer  courtney     = new CricketPlayer();
            WoodenBat      woodenBat    = new WoodenBat();
            AluminumBat    aluminumBat  = new AluminumBat();
            CompositeBat   compositeBat = new CompositeBat();
            CricketBat     cricketBat   = new CricketBat();

            hank.TakeTurn(woodenBat);
            hank.TakeTurn(aluminumBat);
            hank.TakeTurn(compositeBat);

            Console.WriteLine();

            courtney.TakeTurn(cricketBat);

            Console.WriteLine();
        }