Beispiel #1
0
        static void Main(string[] args)
        {
            Puppy puppy = new Puppy();//Multiple Inheritance

            puppy.Eat();
            puppy.Bark();
            puppy.Weep();
            Dog dog = new Dog();//Single Inheritance

            dog.Bark();
            dog.Eat();
            Cat cat = new Cat();//Heirarchial Inheritance

            cat.Meow();
            cat.Eat();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Dog myDog = new Dog();

            myDog.Eat();
            myDog.Bark();
            Console.WriteLine();

            Puppy myPyppy = new Puppy();

            myPyppy.Eat();
            myPyppy.Bark();
            myPyppy.Weep();
            Console.WriteLine();

            Cat myCat = new Cat();

            myCat.Eat();
            myCat.Meow();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Dog   fido  = new Dog();
            Puppy puppy = new Puppy();
            Cat   cat   = new Cat();

            Console.WriteLine("Fido:");
            fido.Eat();
            fido.Bark();
            Console.WriteLine();

            Console.WriteLine("Puppy:");
            puppy.Eat();
            puppy.Bark();
            puppy.Weep();
            Console.WriteLine();

            Console.WriteLine("Cat:");
            cat.Eat();
            cat.Meow();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Animal animal = new Animal();

            Console.WriteLine(animal.Eat());

            Dog dog = new Dog();

            Console.WriteLine(dog.Eat());
            Console.WriteLine(dog.Bark());

            Cat cat = new Cat();

            Console.WriteLine(cat.Eat());
            Console.WriteLine(cat.Meow());

            Puppy puppy = new Puppy();

            Console.WriteLine(puppy.Eat());
            Console.WriteLine(puppy.Bark());
            Console.WriteLine(puppy.Weep());
        }