I'm currently trying to learn Objective C and by this way, Oriented Object languages.
I'm declaring variables from a class I've written, but, my functions are way too long, and I'd like to cut that code off.
I do not know how the return works with classes and that's my problem.
Grapejuice *juice;
juice = [[Grapejuice alloc] init];
[juice setName:@"Grape juice"];
[juice setOrderNumber:1000];
[juice setPrice:1.79];
This, is part of a main in which I'm doing this to several objects, how can I do that in a separated function, and still got these informations out of this new function to be re-used later (to be printed for example) ? Not sure if I'm clear but I've just started learning it yesterday, still hesitating on the basics.
Thanks homies.
Grapejuice *make_juice() { return [[Grapejuice alloc] init]; }?Grapejuice *make_juice() { Grapejuice *juice = [[Grapejuice alloc] init]; [juice setPrice:1.79]; /* etc. */ return juice; }