Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Tunde Adegoroye
20,597 PointsSetter and Getter returning multiple values
I understand how to set up a setter and getter and return a value like so
// Used to set value in the function
-(void)setAge:(float)myAge;
// Would be used to get value
-(float)myAge;
But when dealing with multiple parameters like
-(void)setAge:(float)myAge setHeight:(float)height;
How would i use setters to set these functions in one line
1 Answer

Stone Preston
42,016 Pointsif you really wanted to do it in one line you could do
-(void)setAge:(float)myAge setHeight:(float)height {
_myAge = myAge; _height = height;
}
you are going to have to use separate statements though no matter what
Tunde Adegoroye
20,597 PointsTunde Adegoroye
20,597 PointsOhh so i would have to do it separately referring to the one above so i would have to do this for the getters
Stone Preston
42,016 PointsStone Preston
42,016 Pointsyes you would need to use separate getters