Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# Wrapping Up

Why 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
Steven Parker
216,108 Points

You can edit your question to add a tag, you don't need to post it as an "answer". :wink:

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?

It did :D