예제 #1
0
        /// <summary>
        /// Printing in console each implementation of the IAnimal
        /// </summary>
        /// <param name="animal"></param>
        public static void ListAnimal(IAnimal animal)
        {
            Console.WriteLine("\n---------------------------");
            Console.WriteLine("Animal kind: {0}", animal.AnimalKind());

            Console.WriteLine(" Type of animal by biology : {0}", animal.TypeOfAnimal());

            Console.WriteLine(" Region : {0}", animal.Region());

            Console.WriteLine(" Type of animal by what they eat: {0}", animal.TypeOfAnimalByWhatTheyEat());

            Console.WriteLine(" Description : {0}", animal.Description());

            Console.WriteLine(" Quantity : {0}", animal.Quantity());

            // asiigning type of cage (big/small) depending of type of animal(mammal, bird or reptile)
            if (animal.TypeOfAnimal() == "bird")
            {
                //Abstraction obj = new RefinedAbstraction();
                Bridge.Type type = new SmallCage();
                // Set implementation and call
                type._ICage = new Bird();
                type.MakeType();
            }
            else if (animal.TypeOfAnimal() == "reptile")
            {
                Bridge.Type type = new SmallCage();
                type._ICage = new Reptile();
                type.MakeType();
            }
            else if (animal.TypeOfAnimal() == "mammal")
            {
                // Change implemention and call
                Bridge.Type type = new BigCage();
                type._ICage = new Mammal();
                type.MakeType();
            }
        }
예제 #2
0
 public string Description()
 {
     return(animal.Description() + ", flys");
 }
예제 #3
0
 public string Description()
 {
     return(animal.Description() + ", hunts and eats meat");
 }
예제 #4
0
 public string Description()
 {
     return(animal.Description() + ", mammal");
 }
예제 #5
0
 public string Description()
 {
     return(animal.Description() + ", can swim");
 }