Created
October 25, 2017 07:46
-
-
Save ukitaka/d4b4c8e50f52c539f9ec3c73a035a585 to your computer and use it in GitHub Desktop.
overload
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
protocol Animal {} | |
struct Dog: Animal {} | |
func hoge(_ any: Any) { | |
print("Any") | |
} | |
func hoge(_ dogOpt: Dog?) { | |
print("Optional<Dog>") | |
} | |
func hoge(_ animalOpt: Animal?) { | |
print("Optional<Animal>") | |
} | |
func hoge(_ animal: Animal) { | |
print("Animal") | |
} | |
func hoge(_ dog: Dog) { | |
print("Dog") | |
} | |
func hoge<A: Animal>(_ a: A) { | |
print("A: Animal") | |
} | |
hoge(Dog()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment