Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Cocoa
class GeneralThing<S> {
var stuff: S?
func doIt() {
if let s = stuff {
doWithStuff(s)
}
}
func doWithStuff(stuff: S) -> S {
return stuff
}
}
class SpecificThing<T>: GeneralThing<Int> {
override func doWithStuff(stuff: Int) -> Int {
println("\(stuff + 1)")
return stuff + 1
}
}
let t = SpecificThing<Int>()
t.stuff = 1
t.doIt()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment