Created
January 29, 2017 05:17
-
-
Save wingyplus/314e465aae601135efff225da7132989 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
protocol A { | |
func doSomething() -> String | |
} | |
// AbstractA | |
extension A { | |
func doSomething() -> String { | |
return "Hello from AbstractA" | |
} | |
} | |
class B : A { | |
} | |
let b = B() | |
print(b.doSomething()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
protocol A {
func value: String { get }
func letSubClassImplement()
func doSomething() -> String
}
// AbstractA
extension A {
func doSomething() -> String {
return "Hello from AbstractA"
}
}
class B : A {
func value: String {
get {
return "some value"
}
}
func letSubClassImplement() {
// sub class implementation
}
}
let b = B()
print(b.doSomething())