Created
June 3, 2014 07:19
-
-
Save Leechael/76675b60fa4f479a49dc to your computer and use it in GitHub Desktop.
Property as method and overriding in Swift (impossible for method)
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
import Cocoa | |
class A { | |
var foo : () -> String | |
var baz : Int | |
init () { | |
func _foo () -> String { | |
return "halo" | |
} | |
self.foo = _foo; | |
self.baz = 1 | |
} | |
func jaz () -> String { | |
return "jazz" | |
} | |
} | |
func _bar () -> String { | |
return "benjour" | |
} | |
var b = A() | |
b.foo() | |
//b.jaz = _bar // Cannot assign to 'jaz' in 'b' | |
b.foo = _bar | |
b.foo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment