Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Objects Encapsulation with Properties Using Properties

For 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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi, 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! :sparkles: