Can you do it?
class Card { func match(othercards : [Card]) -> Int { return 2
Yes
In particular, you can, if the Card does not extend NSObject .
class Card { func match(othercards : [Card]) -> Int { return 2
On the other hand, if Card continues to NSObject .
class Card : NSObject { func match(othercards : [Card]) -> Int { return 2
Then you will get an error message!
It seems that overloading only works with pure Swift classes.
source share