コード例 #1
0
        static void Main(string[] args)
        {
            IHomeCat vaska = new YardCat();

            vaska.Name = "Васька";
            CatInfoPrinter.PrintCatInfo(vaska);

            IHomeCat wagner = new PedigreedCat();

            wagner.Name = "Вагнер";
            CatInfoPrinter.PrintCatInfo(wagner);

            IWildCat       tiger   = new Tiger();
            HomeCatAdapter adapter = new HomeCatAdapter(tiger);

            CatInfoPrinter.PrintCatInfo(adapter);

            ISuperhero       elph = new Elph();
            SuperheroAdapter superheroAdapteradapter = new SuperheroAdapter(elph);

            Console.WriteLine("Досье для героя: {0} {1} {2}", superheroAdapteradapter.Fly(),
                              superheroAdapteradapter.Shoot(), superheroAdapteradapter.GoThrougWalls());

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: alexx1994/Study
        static void Main(string[] args)
        {
            IHomeCat vaska = new YardCat();

            vaska.Name = "Vaska";
            CatInfoPrint.PrintCatInfo(vaska);

            IHomeCat wagner = new PedigreedCat();

            wagner.Name = "Wagner";
            CatInfoPrint.PrintCatInfo(wagner);

            IWildCat       tiger   = new Tiger();
            HomeCatAdapter adapter = new HomeCatAdapter(tiger);

            CatInfoPrint.PrintCatInfo(adapter);

            Console.ReadLine();
        }