Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created October 15, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/dfc81dee6c87c9ac60776f33a62009ad to your computer and use it in GitHub Desktop.
Save fitomad/dfc81dee6c87c9ac60776f33a62009ad to your computer and use it in GitHub Desktop.
public class RoverFactory
{
/**
Construimos un nuevo Rover para que explore un entorno
determinado
*/
public static func makeRover(for explore: Exploration) -> Rover
{
switch explore
{
case .aerial:
return AirRover(named: "Curiosity")
case .terrestrial:
return LandRover(named: "Spirit")
case .nautical:
return SeaRover(named: "ExoMars")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment