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
Simon Andersson6,880 Points
Confused on "this"
Hi. When the constructor is created, you say "this refers to the CURRENT object". What do you mean by the current object?
Steven Parker227,114 Points
The current object is the one being created when the constructor runs.
The constructor code only runs when an instance of the class is being created. Inside the constructor, "this" represents that new instance.
Alexandre C.1,245 Points
I am a little bit confused about encapsulation. I understand that if I use the class, I can't modify the array, because it uses the public MapLocation/path, which also uses the private MapLocation/_path
What I don't understand is what prevents me to use the MapLocation in Main. Could'nt I acces this Main/MapLocation and change the values of the array?
I hope you understand me, I'm pretty newbie into the coding-world.