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 trialRyan Hartigan
3,425 PointsWhat does he mean by the "instance is responsible"?
When that instance is used, like when we change an attribute on it or call a method, the instance is responsible and not the class it was instantiated from"
1 Answer
devin leyba
7,209 PointsI had the same question. That helps. Thank you James.
James Joseph
4,885 PointsJames Joseph
4,885 PointsWhen you give a variable an object of the class you've used you are creating a duplicate copy of that class for usage essentially creating an instance of it.
What he's saying is when you change an attribute that instance of the object is affected by the change, not the class you originally coded.
Example:
That max_speed has changed only on the instance of car it has not changed on the class ProjectCar(). If I wanted to change original max speed I would have to edit the class of ProjectCar()
Hope that helps