예제 #1
0
        static void Main(string[] args)
        {
            Hewan hewan;

            hewan = new Herbivora();
            hewan.Dekriptif();

            hewan = new Karnivora();
            hewan.Dekriptif();

            hewan = new Omnivora();
            hewan.Dekriptif();


            IHewan Ihewan;

            Ihewan = new Vivipar();
            Ihewan.deskriptif();

            Ihewan = new Ovipar();
            Ihewan.deskriptif();

            Ihewan = new Ovovivipar();
            Ihewan.deskriptif();

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Hewan hewan;          // Menggunakan Abstract Class

            hewan = new Herbivora();
            hewan.Jenis();

            Console.WriteLine();
            hewan = new Karnivora();
            hewan.Jenis();

            Console.WriteLine();
            hewan = new Omnivora();
            hewan.Jenis();


            /*IHewan hewan;       // Menggunakan Abstract Class
             * hewan = new Herbivora();
             * hewan.Jenis();
             * Console.WriteLine();
             * hewan = new Karnivora();
             * hewan.Jenis();
             * Console.WriteLine();
             * hewan = Omnivora();
             * hewan.Jenis()*/

            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            //Abstraction.AbstractClass;

            /*Animal animal;
             *
             * animal = new Herbivora();
             * animal.Makanan();
             *
             * Console.WriteLine();
             * animal = new Carnivora();
             * animal.Makanan();
             *
             * Console.WriteLine();
             * animal = new Omnivora();
             * animal.Makanan();*/

            //Abstraction.Interface;
            IAnimal animal;

            animal = new Herbivora();
            animal.Makanan();

            Console.WriteLine();
            animal = new Carnivora();
            animal.Makanan();

            Console.WriteLine();
            animal = new Omnivora();
            animal.Makanan();

            Console.ReadKey();
        }