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; }
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); }