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 trialSamar Khanna
1,757 PointsWhy don't we need to initialise size?
All the other properties are initialised, but why isn't size initialised?
1 Answer
Jayden Spring
8,625 PointsFrom a quick glance at Amit's video it is initialised. Size is an enum which is initialised inside of clothing which can be seen on the line of;
enum Size{
case .Small, .Medium, .Large
init(){ self = .Small }
}
class Clothing: Product {
var size = Size()
}
So when Clothing is initialised, Size is too and by default is .Small
Samar Khanna
1,757 PointsSamar Khanna
1,757 PointsOh sorry, didn't realise that. Thanks!!!