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

iOS

Solution is incomplete

I solved following challenge but I'm unhappy with the solution. If adding an additional stored value " numerOfSeats" wouldn't it make sense for the someCar to have 3 values such as wheels, doors AND seats?

Challenge Task 1 of 1

In the editor, I have provided a class named Vehicle.

Your task is to create a subclass of Vehicle, named Car, that adds an additional stored property numberOfSeats of type Int with a default value of 4.

Once you've implemented the Car class, create an instance and assign it to a constant named someCar.

1 Answer

Hi, O.

I can't remember the challenge entirely and your question doesn't provide much context so I'll assume you haven't provided a value for the number of seats property at initialisation.

Since you've provided a default value, there's no need provide a value at initialisation; if you want your "someCar" to have 4 seats. However, you could.

If this doesn't satisfy your curiosity, do provide the code you're referring to.