예제 #1
0
        static void Main(string[] args)
        {
            // Initialize an object (spot) of the Dog class.
            Dog spot = new Dog(true, 25);

            // Methods for Dog class.
            spot.Greet();
            spot.Talk();
            spot.Sing();
            spot.Fetch("stick");

            // Interface for Dog class.
            spot.PetMe();
            spot.FeedMe();

            Console.WriteLine(spot.ToString());

            // Initialize an object (red) of the Robin class.
            Robin red = new Robin();

            // Methods for Robin class.
            red.Talk();
            red.Sing();

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Dog fido = new Dog(false, 25);

            fido.Greet();
            fido.Talk();
            fido.Sing();
            fido.Fetch("stick");

            fido.TouchMe();
            fido.FeedMe();

            Console.WriteLine(fido.ToString());

            Robin red = new Robin();

            red.Talk();
            red.Sing();

            Console.ReadLine();
        }