Skip to content

Instantly share code, notes, and snippets.

Created Aug 11, 2017
What would you like to do?
//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