Created
August 11, 2017 09:11
-
-
Save mayooresan/cb356ced23a507dd7853df941cd20d8f 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
//War tank objects | |
var t10 = WarTank() | |
var t11 = WarTank() | |
t11.topSpeed = 110.0 | |
//Spy Jeep Objects | |
var sj10 = SpyJeep() | |
var sj11 = SpyJeep() | |
sj11.topSpeed = 190.0 | |
// Extensions | |
extension WarCapable{ | |
func canTravelFaster(item : WarCapable)->Bool{ | |
return self.topSpeed > item.topSpeed | |
} | |
} | |
t10.canTravelFaster(item: t11) | |
// returns false | |
sj11.canTravelFaster(item: t11) | |
// returns true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment