hi, Does objective C support method overloading.
suppose there are 2 methods:
(int)add(int)X : (int) Y;
(float)add(float)X : (float) Y;
The selector for the two methods is the same
add::
But the runtime would be confused as to which method to invoke based on this selector, so i think method overloading is not supported.
I also came through the following paragraph in Objective C 2.0 PDF, i could not understand this. Can anyone help me?
"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 arguments, 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 argument types. (Statically typed receivers are an exception to this rule, since the
compiler can learn about the method implementation from the class type.) "
suppose there are 2 methods:
(int)add(int)X : (int) Y;
(float)add(float)X : (float) Y;
The selector for the two methods is the same
add::
But the runtime would be confused as to which method to invoke based on this selector, so i think method overloading is not supported.
I also came through the following paragraph in Objective C 2.0 PDF, i could not understand this. Can anyone help me?
"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 arguments, 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 argument types. (Statically typed receivers are an exception to this rule, since the
compiler can learn about the method implementation from the class type.) "