I am new to programming, and trying to tweak a very simple Hello World program which runs in the Console.
I get the same error twice in the following code:
I can't figure out why; the syntax seems to be correct and logical for me -- but obviously it isn't
Guidance would be greatly appreciated!
I get the same error twice in the following code:
Code:
#import <Foundation/Foundation.h>
@interface Message : NSObject
- (void) displayMessage: (textToDisplay) txt; // error: Expected ')' before 'textToDisplay'
@end //Message
@implementation Message
- (void) displayMessage: (textToDisplay) txt // error: Expected ')' before 'textToDisplay'
{
NSLog (@"%@", txt);
}
@end //Message
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Message * Messenger = [Message new];
[Messenger displayMessage: (@"Hello, World!")];
[pool drain];
return 0;
}
I can't figure out why; the syntax seems to be correct and logical for me -- but obviously it isn't
Guidance would be greatly appreciated!