Skip to content

Instantly share code, notes, and snippets.

@akrennmair
Created July 5, 2011 21:46
Show Gist options
  • Save akrennmair/1066047 to your computer and use it in GitHub Desktop.
Save akrennmair/1066047 to your computer and use it in GitHub Desktop.
a := NewAmphibian()
a.Accelerate(10)
a.Swim(true)
a.Accelerate(20)
fmt.Printf("amphibian speed swimming: %d kph\n", a.Speed())
a.Swim(false)
fmt.Printf("amphibian speed on land: %d kph\n", a.Speed())
var d Drivable
d = a
fmt.Printf("amphibian speed on land (as drivable): %d kph\n", d.Speed())
a.Swim(true)
fmt.Printf("amphibian speed swimming (as drivable): %d kph\n", d.Speed())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment