@@ -31,7 +31,7 @@ class Vehicle
3131class Bicycle : Vehicle
3232{
3333 // We'll make this a 2-wheeled vehicle
34- init ( )
34+ override init ( )
3535 {
3636 super. init ( )
3737 numberOfWheels = 2
@@ -46,7 +46,7 @@ bicycle.description()
4646class Tandem : Bicycle
4747{
4848 // This bicycle has 2 passengers
49- init ( )
49+ override init ( )
5050 {
5151 super. init ( )
5252 maxPassengers = 2
@@ -61,7 +61,7 @@ class Car: Vehicle
6161 var speed : Double = 0.0
6262
6363 // New initialization, starting with super.init()
64- init ( )
64+ override init ( )
6565 {
6666 super. init ( )
6767 maxPassengers = 5
@@ -143,21 +143,21 @@ automaticCar.gear
143143// ------------------------------------------------------------------------------------------------
144144// Preenting Overrides
145145//
146- // We can prevent a subclass from overriding a particular method or property using the '@ final'
146+ // We can prevent a subclass from overriding a particular method or property using the 'final'
147147// keyword.
148148//
149- // @ final can be applied to: class, var, func, class methods and subscripts
149+ // final can be applied to: class, var, func, class methods and subscripts
150150//
151151// Here, we'll prevent an entire class from being subclassed by applying the . Because of this,
152- // the @ finals inside the class are not needed, but are present for descriptive purposes. These
153- // additional @ finals may not compile in the future, but they do today:
154- @ final class AnotherAutomaticCar : Car
152+ // the finals inside the class are not needed, but are present for descriptive purposes. These
153+ // additional finals may not compile in the future, but they do today:
154+ final class AnotherAutomaticCar : Car
155155{
156156 // This variable cannot be overridden
157- @ final var gear = 1
157+ final var gear = 1
158158
159159 // We can even prevent overridden functions from being further refined
160- @ final override var speed : Double
160+ final override var speed : Double
161161 {
162162 didSet { gear = Int ( speed / 10.0 ) + 1 }
163163 }
0 commit comments