Created
July 5, 2011 21:46
-
-
Save akrennmair/1066047 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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