@interface Caculator2 : NSObject
//四个方法
-(int)add:(int) num1 andNum2:(int) num2;
-(int)jian:(int) num1 andNum2:(int) num2;
-(int)cheng:(int) num1 andNum2:(int) num2;
-(float)chu:(int) num1 andNum2:(int) num2;
@end
@implementation Caculator2
-(int)add:(int) num1 andNum2:(int) num2{
return num1+num2;
}
-(int)jian:(int) num1 andNum2:(int) num2{
return num1-num2;
}
-(int)cheng:(int) num1 andNum2:(int) num2{
return num1*num2;
}
-(float)chu:(int) num1 andNum2:(int) num2{
return num1/(float)num2;
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
Caculator2 *c2 = [Caculator2 new];
[c2 add:12 andNum2:34];
//这句调用后,12 和34 占用的是哪里的内存,堆里面吗?
}
return 0;
}
[c2 add:12 andNum2:34];
//这句调用后,12 和34 占用的是哪里的内存,堆里面吗? |
|