daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest May 16th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  main.m
  3. //  calc
  4. //
  5. //  Created by hyeon woo park on 12. 1. 5..
  6. //  Copyright (c) 2012년 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import <Foundation/Foundation.h>
  10.  
  11. @interface gcalc: NSObject
  12. {
  13. int num1;
  14. int num2;
  15. }
  16. @property int num1, num2;
  17.  
  18. - (int) add;
  19. - (int) del;
  20. - (int) div;
  21. - (int) multi;
  22. @end
  23.  
  24. @implementation gcalc
  25. @synthesize num1, num2;
  26.  
  27. - (int) add
  28. {
  29.     return num1 + num2;
  30. }
  31.  
  32. - (int) del
  33. {
  34.     return num1 - num2;
  35. }
  36.  
  37. - (int) div
  38. {
  39.     return num1 / num2;
  40. }
  41.  
  42. - (int) multi
  43. {
  44.     return num1 * num2;
  45. }
  46.  
  47. @end
  48.  
  49. int main (int argc, const char * argv[])
  50. {
  51.  
  52.     @autoreleasepool {
  53.        
  54.         gcalc *calc = [[gcalc alloc] init];
  55.        
  56.        
  57.         [gcalc num1: 1];
  58.         [gcalc num2: 2];
  59.        
  60.         NSlog(@"Add 1+1 = %i", [gcalc add]
  61.               );
  62.        
  63.     }
  64.     return 0;
  65. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top