Reputation: 1213
This question may be duplicate of the Objective C - "Duplicate declaration of method" compilation error
But i am still confuse for why objective C dose not support the function Overloading / method overloading
Can any one tell me the proper reason for why this error occur?
Upvotes: 1
Views: 2745
Reputation: 2291
I want to tell you please check the "How to define method ?", You can found in above link about multiple input method also. and this one is for naming conventions of method in Objective C?
As per above we can know that your method have same name(Signature) as getText:
In your case there are duplicated method you define which is not supported by objective C Compiler.
Hope this one helpful to you.
Upvotes: 0
Reputation: 40221
Simply because Objective-C doesn't support overloading. And besides it is highly recommended to include the types of the arguments in the function's name, whenever possible. Try getTextFromTextView:
and getTextFromTextField:
instead.
Upvotes: 4
Reputation: 8947
read this thread that why objective c does not suport method overloading
Why Objective-C doesn't support method overloading?
and this is apple discussion form https://discussions.apple.com/thread/512569?start=0&tstart=0
Upvotes: -1
Reputation: 8109
objective-C does not support method overloading, so you have to use different method names.
Upvotes: 4