I noticed that the compiler won't let me override a stored property with another stored value (which seems odd):
class Jedi {
var lightSaberColor = "Blue"
}
class Sith: Jedi {
override var lightSaberColor = "Red" // Cannot override with a stored property lightSaberColor
}
However, I'm allowed to do this with a computed property:
class Jedi {
let lightSaberColor = "Blue"
}
class Sith: Jedi {
override var lightSaberColor : String{return "Red"}
}
Why am I not allowed to give it another value?
Why is overriding with a stored property an abomination and doing it with a computed one kosher? What where they thinking?