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
what does the "this" do ?
what does the "this" do exactly ? and why do we have to use it in this case ?
Steven Parker228,077 Points
Inside a constructor, "this" refers to the object that is being created.
Since the "base" has already loaded in the values for "X" and "Y", the object can be passed to the "Map" function "onMap" to determine if the coordinates are valid.
ok As You said: Inside a constructor, "this" refers to the object that is being created, so in that case what is the object that is created? ...MapLocation?
forget Python for that and answer the question because I have the same question, if I don't want to write the keyword "this", what object I would write