示例#1
0
        static void AbstractDemo()
        {
            TRex        myTrex        = new TRex();
            Triceratops myTriceratops = new Triceratops();

            myTrex.EatFood();
            myTrex.Move();
            myTrex.Sleeps();
            myTrex.Communicates();
            myTrex.SkinType();
            myTrex.Teeth();

            Console.WriteLine(" ");

            myTriceratops.EatFood();
            // has not been overwritten so "the dinosaur moves"
            myTriceratops.Move();
            myTriceratops.Sleeps();
            myTriceratops.Communicates();
            myTriceratops.SkinType();
            myTriceratops.Teeth();

            Console.WriteLine(" ");

            Teradactyl myTeradactyl = new Teradactyl();

            myTeradactyl.EatFood();
            myTeradactyl.Move();
            myTeradactyl.Sleeps();
            myTeradactyl.Communicates();
            myTeradactyl.Teeth();
            myTeradactyl.SkinType();
        }
示例#2
0
        static void AbstractDemo()
        {
            TRex        trex        = new TRex();
            Triceratops triceratops = new Triceratops();

            trex.EatFood();
            trex.Move();
            trex.SkinType();

            triceratops.EatFood();
            triceratops.Move();
            triceratops.Teeth();
        }