Skip to content

Instantly share code, notes, and snippets.

@chris-hatton
Last active December 31, 2015 21:36
Show Gist options
  • Save chris-hatton/7fe327d8af46d4b37f6b to your computer and use it in GitHub Desktop.
Save chris-hatton/7fe327d8af46d4b37f6b to your computer and use it in GitHub Desktop.
protocol ProtocolA {}
protocol ProtocolB {}
func overloadingTest ( obj: String ) -> String
{
return "It's a String"
}
func overloadingTest ( obj: Int ) -> String // This compiles fine, and the appropriate 'topLevelTest' function is called
{
return "It's an Int"
}
func aFunction()
{
func nestedOverloadingTest ( obj: String ) -> String
{
return "It's a String"
}
func nestedOverloadingTest ( obj: Int ) -> String // Fails to compile with 'Definition conflicts with previous value'
{
return "It's an Int"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment