title: In Objective-C, how to use 'self' in main() function?
body: <p>I have the definition:</p>
  
  <pre><code>@interface MyClass: NSObject
  {
     NSString *str;
     id delegate;
  }
  -(id)initWithStr:(NSString *)str
          delegate:(id)delegate;
  @end
  </code></pre>
  
  <p>and when i send message to my object in the main.m like this:</p>
  
  <pre><code>int main(int argc, const char * argv[])
  {
      @autoreleasepool {
         [[MyClass alloc] initWithStr:@"abc-xyz"
                             delegate:self];
      }
  }
  </code></pre>
  
  <p>There is the error <strong>"Use of undeclared identifier 'self' "</strong>.   I m a newb of objective-c and I know that the 'self' indicates the receiver of the message, but i don't know how to use it in the main() function. Can anybody tell me what's wrong about it and how to fix it?</p>