Inheritance question


I am at a loss, why this does not work? I want to set the value of bodyMassIndex, then get that property and print it out to the console in main.m


Person *bodyMass = [[Person alloc]init]; //[bodyMass setBodyMassIndex:100]; NSLog (@"bodyMass is: %f", [bodyMass bodyMassIndex]);
I have declared the property in Person.h

synthesized it in person.m, and set it´s value using it´s getter (this value is what i want the NSLog to print out in main.m)

[code]@synthesize bodyMassIndex;

-(float) setBodyMassIndex
self.bodyMassIndex = 200;
return bodyMassIndex;


I think you just misnamed your getter method:

- (float)bodyMassIndex { return bodyMassIndex; }