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 trialRa Bha
2,201 PointsFor the Move method with void keyword (see code below), does the void keyword limit writing a property with getter
For the Move method with void keyword (see code below):
public void Move()
If we were to need to change this method to a property, would the presence of the void keyword limit the writing of a property using a getter since void doesn't return anything?
1 Answer
Jennifer Nordell
Treehouse TeacherHi, Ra Bha! I feel like you're mixing up the point of a property and the point of a method. The point of a method is to do something. The point of a property is to describe something about that class. For example, my first name is Jennifer. That's one of my properties. My last name is Nordell. That's another property. Now, I could have a computed property like fullName
that is the combination of my first name and last name. But it's still not an action. However, signing my full name on a document would be an action involving that computed property and that should be a method.
In short, I don't believe there is a way to make Move()
a property because it is not a descriptor... it's an action. Properties are like adjectives, computed properties are a bit like combining two or more adjectives, and methods are the verbs.
Hope this helps!