ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## Inheritance Swift classes do not inherit from a universal base class. Classes you define without specifying a superclass automatically become base classes for you to build upon. ~~~ class Car: Vehicle { var speed: Double = 0.0 init() { super.init() maxPassengers = 5 numberOfWheels = 4 } override func description() -> String { return super.description() + "; " + "traveling at \(speed) mph" } } ~~~ You can present an inherited read-only property as a read-write property by providing both a getter and a setter in your subclass property override. You cannot, however, present an inherited read-write property as a read-only property. You can prevent a method, property, or subscript from being overridden by marking it as final