Question: class ServiceClass { public static IService getInstance ( string serviceChoice ) { IService service = null; switch ( serviceChoice ) { case Car: service =

class ServiceClass {
public static IService getInstance(string serviceChoice){
IService service = null;
switch (serviceChoice)
{
case "Car":
service = new Car();
break;
case "Limo":
service = new Limo();
break;
}
return service;
}
}
The above sample code is an implementation of the?
class ServiceClass {
public static IService getInstance(string serviceChoice){
IService service = null;
switch (serviceChoice)
{
case "Car":
service = new Car();
break;
case "Limo":
service = new Limo();
break;
}
return service;
}
}
The above sample code is an implementation of the?
Factory Pattern
Command Pattern
Observer Pattern
Singleton Pattern

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!