Example #1
0
 public static IChoice getChoiceObj(string choice)
 {
     IChoice objChoice = null;
     if(choice.ToLower()=="car")
     {
         objChoice = new Car();
     }
     else if (choice.ToLower() == "bike")
     {
         objChoice = new Bike();
     }
     else
     {
         objChoice = new InvalidChoice();
     }
     return objChoice;
 }
Example #2
0
        static public IChoice getChoiceObj(string choice)
        {
            IChoice objChoice = null;

            if (choice.ToLower() == "car")
            {
                objChoice = new Car();
            }
            else if (choice.ToLower() == "bike")
            {
                objChoice = new Bike();
            }
            else
            {
                objChoice = new InvalidChoice();
            }
            return(objChoice);
        }