コード例 #1
0
        static void Main(string[] args)
        {
            //Testing Grizzly functionality
            Console.WriteLine("Testing Grizzly functions: ");

            Bear B = new Grizzly();

            B.hibernate();
            B.maul();

            //Separates Grizzly fronm next tests
            Console.WriteLine();



            //Testing Toy Bear functionality
            Console.WriteLine("Testing Toy Bear functions: ");

            Toy_Bear T = new Teddy_Bear();

            T.hug();

            //Separates Teddy Bear from next tests
            Console.WriteLine();



            //Testing Bear Adapter functionality
            Console.WriteLine("Testing Bear Adapter functions: ");

            //Previously created Grizzly, B, passed to constructor
            Toy_Bear A = new Bear_Adapter(B);

            //Should call maul(), if everything works properly
            A.hug();

            //Allows user to read output without window disappearing
            Console.ReadKey();
        }
コード例 #2
0
 //Parameterized constructor for Bear_Adapter
 public Bear_Adapter(Bear User_Bear)
 {
     User_Bear  = new Grizzly();
     Adapt_Bear = User_Bear;
 }