lots of args. (was Anyone Still Interested)
Quote from Forum Archives on February 5, 2010, 11:09 pmPosted by: rtulloch <rtulloch@...>
Robert Covington wrote:> So, how in the world, would one create an 8 parameter monster like I
> enjoy in FB at times, in Cocoa? How would you have to prototype and
> define, what files to create and such?//
// MyClass.h --- header file
//#import
@interface MyClass : NSObject {
}
-(void)messageWithLotsOfArgs:(int)a secondArg:(int)b thirdArg:(int)c
fourthArg:(int)d andTheLast:(int)e;
@end////////////////// CUT HERE ////////////////
//
// MyClass.m -- implementation file .m
//#import "MyClass.h"
@implementation MyClass
-(void)messageWithLotsOfArgs:(int)a secondArg:(int)b thirdArg:(int)c
fourthArg:(int)d andTheLast:(int)e
{
printf("a = %d
b = %d
c = %d
d = %d
e = %d",a,b,c,d,e);
}@end
////////////////// CUT HERE. HOW TO CALL: ////////////////
MyClass* object = [[[MyClass alloc] init] autorelease];
[object messageWithLotsOfArgs:1 secondArg:2 thirdArg:3 fourthArg:4
andTheLast:5];Hope that helps,
Ross.
Posted by: rtulloch <rtulloch@...>
> So, how in the world, would one create an 8 parameter monster like I
> enjoy in FB at times, in Cocoa? How would you have to prototype and
> define, what files to create and such?
//
// MyClass.h --- header file
//
#import
@interface MyClass : NSObject {
}
-(void)messageWithLotsOfArgs:(int)a secondArg:(int)b thirdArg:(int)c
fourthArg:(int)d andTheLast:(int)e;
@end
////////////////// CUT HERE ////////////////
//
// MyClass.m -- implementation file .m
//
#import "MyClass.h"
@implementation MyClass
-(void)messageWithLotsOfArgs:(int)a secondArg:(int)b thirdArg:(int)c
fourthArg:(int)d andTheLast:(int)e
{
printf("a = %d
b = %d
c = %d
d = %d
e = %d",a,b,c,d,e);
}
@end
////////////////// CUT HERE. HOW TO CALL: ////////////////
MyClass* object = [[[MyClass alloc] init] autorelease];
[object messageWithLotsOfArgs:1 secondArg:2 thirdArg:3 fourthArg:4
andTheLast:5];
Hope that helps,
Ross.