Have limited Python programming experience and started learning Objective C and have a couple questions before I move on in the book 'Prog. in Obj-C'.
I understand purpose of Objects and instances of Objects. I need help with part of this.
The first line creates the Object named Fraction - I get that.
The Object has 2 variables of type integer - I get that.
I read and understand the next part with the -(void) setNumerator: (int) n; and how all that works, but what I don't get is why that code is in the Object? These come up again in the next part of the code called '@implementation Fraction'. Are these 3 -(VOID) lines kind of like doorways to pass the information to and from instance Objects?
I hope I was not to confusing in trying to explain this.
thanks!
I understand purpose of Objects and instances of Objects. I need help with part of this.
Code:
@interface Fraction: NSObject
{
int numerator;
int denominator;
}
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
@end
The first line creates the Object named Fraction - I get that.
The Object has 2 variables of type integer - I get that.
I read and understand the next part with the -(void) setNumerator: (int) n; and how all that works, but what I don't get is why that code is in the Object? These come up again in the next part of the code called '@implementation Fraction'. Are these 3 -(VOID) lines kind of like doorways to pass the information to and from instance Objects?
I hope I was not to confusing in trying to explain this.
thanks!