I get this as an error
Request for member 'denominator' in something not a structure or union
when I try and compile the following code.
-(id) add: (id) f
// To add two fractions
// a/b + c/d = ((a*d) + (b*c)) / (b * d)
// result will store the result of the addition
id result = [[Fraction alloc] init];
int resultNum, resultDenom;
resultNum = numerator * f.denominator + denominator * f.numerator;
resultDenom = denominator * f.denominator;
[result setTo: resultNum over: resultDenom];
When I stop using the dot syntax for f.denominator in favour of [f denominator] everything works fine. Can someone please help me understand why one is Ok and the other isn't?
I've used this code before but when I changed it to accept and return id objects it stopped working as it used to.