home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / Tutorial / Cookbook / 04.new / MyObject.m < prev    next >
Encoding:
Text File  |  1993-01-19  |  602 b   |  35 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "MyObject.h"
  5. #import <stdio.h>
  6.  
  7. @implementation MyObject
  8.  
  9. + new                    // this section of code will get run only once
  10. {
  11.    self = [super new];  // create new instance of myObject by sending the
  12.                         // "new" message to our superclass plus run the
  13.             // following code:
  14.    myInt = 100;
  15.    printf("new myInt = %d\n", myInt);
  16.    return self;
  17. }
  18.  
  19. - event1:sender
  20. {
  21.     myInt++;
  22.     printf("myInt++ = %d\n", myInt);
  23.     return self;
  24. }
  25.  
  26. - event2:sender
  27. {
  28.     myInt--;
  29.     printf("myInt-- = %d\n", myInt);
  30.     return self;
  31. }
  32.  
  33.  
  34. @end
  35.