arguement..

whitesaint

cocoa love
Okay, alot of us are Cocoa programmers here. We also all know that the only way to access an object's data is through it methods. However, one problem (with many others) may be confusing the hell out of us - Alot of methods' have arguements! If you're working with a different object, and import the header file, the run-time system and the compiler will only recognize methods, not any additional arguements. Is there anyway to declare an arguement in a way you declare a method?

Thanks in advance...
 
I'm not sure what you are talking about (please use the OmniWeb spell-checker! :)); do you mean something like

-(returnType)functionArg1: (arg1Type)arg1Name arg2: (arg2Type) arg2Name;

-(void) takeValue: (id)newValue forKey: (NSString *)attrName;

? It works fine. Download someone else's source code to see what you are doing wrong.
 
As best I can figure, IB doesn't even look at the arguments. It is assumed that you're doing things right, or that there is one argument, the sender. Inter Object relations in Cocoa do a LOT of this. It simplifies calls and makes methods really versatile, but like in the java tutorial the reciever methed checks out the sender or it's data as necessary to make things go.

If you want to make a subclass that also takes the same call with different args, you can do that. ... or I may just have no idea what you're talking about. :)
 
Back
Top