objective-c 方法值类型与引用类型传递
- (void)viewDidLoad
{
int testNum=10;
NSString* testStr=@"Hi";
GoodsBasicInfoEntity*testGBIE=[[GoodsBasicInfoEntity alloc]init];
testGBIE.pC_Name=@"1111";
[self testEdit: &testNum str:&testStr testGBIE:testGBIE];
NSLog(@"%d,,,,,,%@,,,,,,%@",testNum,testStr,testGBIE.pC_Name);//输出:20,,,,,,hello,,,,,,how are you ?
}
-(void)testEdit:(int *)num str:(NSString**)str testGBIE:(GoodsBasicInfoEntity*)testGBIE
{
*num=20;
*str=@"hello";
testGBIE.pC_Name=@"how are you ?";
testGBIE=[[GoodsBasicInfoEntity alloc]init];
testGBIE.pC_Name=@"123";
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。