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 trialBryan Huckeba
1,666 PointsMy code won't compile online it worked in Xcode and said there were no problems but the online version gives me an error
I put this in online and I get the Bummer! error when it works just fine on Xcode is there anything I am doing wrong code wise?
class Button {
var width: Double
var height: Double
init(width:Double, height:Double){
self.width = width
self.height = height
}
class RoundButton: Button{
var cornerRadius: Double = 5.0
}
var rounded = RoundButton(width: 10.0, height: 10.0)
}
1 Answer
Piotr Nejman
3,374 PointsIt's almost correct, but as I see you put the subclass inside the class Button
class Button {
var width: Double
var height: Double
init(width:Double, height:Double){
self.width = width
self.height = height
}
}
class RoundButton: Button{
var cornerRadius: Double = 5.0}
var rounded = RoundButton(width: 10.0, height: 10.0)
Bryan Huckeba
1,666 PointsBryan Huckeba
1,666 PointsThank you very much! I was looking at that for an hour xD