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! While you're at it, check out some resources Treehouse students have shared here.
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 trialDavid Douglas
3,719 PointsGetters for set properties
In previous videos we used a getter method to retrieve a backing property declared in a setter. In this answer section the area and circumference properties are called through dot notation. Can you explain why?
1 Answer
Steven Parker
231,269 PointsGetter methods and ordinary properties are both accessed through dot notation. Calling a getter looks exactly like a reference to a property in the code.
But the reason area and circumference don't need getter methods is that they are set by the radius setter method and don't have setters of their own. Since there are no setters using the same name, they can be ordinary properties.