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 trial<noob />
17,062 PointsWhy we need to pass the title to the MediaType parent class?
I understand that Album,Book and Movie are all inherit from MediaType(her methods,fields and so on) however i still dont clear about the use of the base keyword in each of the types why we need to pass the title to the parent class and why we delete the Title field from each of them. The definition of a mediatype is that a mediatype must have a title because the constructor of the MediaType class has a title, it is the minimum requirment of a type to be a media type. we pass the title parameter in each of the types(album,book etc..) to the base class constructor, I dont fully see the purpose of it beside that in order to inherit from MediaType we must a title, it is the purpose?
3 Answers
Steven Parker
231,236 PointsYou can edit your question to add a tag, you don't need to post it as an "answer".
And yes, if a base class constructor requires an argument, then it makes sense that any derived class would pass that argument on to the base as part of it's own constructor.
Does that answer your question?
<noob />
17,062 Points<noob />
17,062 PointsIt did :D