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 trialTyler Wells
Python Development Techdegree Student 2,678 PointsWhat exactly did we gain by doing this?
Kenneth said at the end of this example that it saved us a bunch of time... But what exactly did we gain in this example by creating the Character superclass?
Thanks in advance for the clarification!
2 Answers
Steven Parker
231,236 PointsThe advantage is that all the properties that the various character types have in common can be coded just once, in the "Character" super-class. Then, the individual characters inherit them instead of having to have separate code for them.
Dan Olson
4,875 PointsYes, that may be true in general, but the question is still valid. There is nothing in this example that shows us we gained anything. In fact, I would argue it was more work to accomplish the same thing. It would be more helpful if we had an example that showed us a specific advantage we gain by creating super- and sub-classes here.