From the Apple Objective-C documentation, bolded relevant parts:
Method Return and Parameter Types
The messaging routine has access to method implementations only through selectors, so it treats all methods with the same selector alike. It discovers the return type of a method, and the data types of its parameters, from the selector. Therefore, except for messages sent to statically typed receivers, dynamic binding requires all implementations of identically named methods to have the same return type and the same parameter types. (Statically typed receivers are an exception to this rule because the compiler can learn about the method implementation from the class type.)
Although identically named class methods and instance methods are represented by the same selector, they can have different parameter types and return types.
I've read this block over and over but I can't seem to get past what seems to be a contradiction. First it says that all implementations of identically named methods are required to have the same return type and parameter types because of dynamic binding.
Since it treats all methods with the same selector alike, does this mean that no matter how many different objects I have, if they all have a EatCake() method then they will all share the same selector for EatCake? If so, then why must they have the same parameters and return type?
Then in the next part it says though they are represented by the same selector, they can have different parameter types and return types. So now I'm totally confused, I thought it just said this was not the case.
I do not expect that this is a mistake, I expect that I am simply not understanding what the difference is between these two statements.
Can anyone clear this up for me?