I'm trying to use as little memory as possible in my code. I've tried two ways of sending a custom class object to a method. I'm not sure if there is any difference between these two approaches. Say I have 2 classes, Class1 and Class2 each with their own class variables and methods of course.
All code is written in Class1
Approach 1:
Class2 *class2Object = [[Class2 alloc] init];
[self doSomething: class2Object];
[class2Object release];
-(void) doSomething: (Class2 *) var {
int a = var.a;
}
Approach 2:
Class2 *class2Object = [[Class2 alloc] init];
[self doSomething: &class2Object];
[class2Object release];
-(void) doSomething: (Class2 **) var {
int a = var->a;
}
Is there any performance difference between these two methods? Is the second approach completely pointless? Why is it that I can use the dot notation in Approach 1, but have to use -> in Approach 2?
Thanks.