Created
July 7, 2018 19:02
-
-
Save xcadaverx/48f0a8c5d8c5b1b7c5a978b29d970046 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
class FooSubClass: SomeFoo {} | |
extension Foo where Self: FooSubClass { | |
func bar() { | |
print("Foo.FooSubclass.bar()") | |
} | |
} | |
let fooSubClassOne: Foo = FooSubClass() | |
fooSubClassOne.bar() // Foo.SomeFoo.bar() 🤨 | |
let fooSubClassTwo: SomeFoo = FooSubClass() | |
fooSubClassTwo.bar() // Foo.SomeFoo.bar() 🧐 | |
let fooSubClassThree: FooSubClass = FooSubclass() | |
fooSubClassThree.bar() // Foo.FooSubClass.bar() 🤯 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment