In the object-oriented programming example, we created a Vehicle superclass from which all the vehicle classes were derived. In the protocol-oriented programming example, we used a combination of protocols and protocol extensions to achieve the same result; however, there are several advantages to the protocol-oriented design.
To refresh our memory of the two solutions, let's examine the code for both the Vehicle superclass and the Vehicle protocol and protocol extension. The following code shows the Vehicle superclass:
class Vehicle {
fileprivate var vehicleTypes = [TerrainType]()
fileprivate var vehicleAttackTypes = [TerrainType]()
fileprivate var vehicleMovementTypes = [TerrainType]()
fileprivate var landAttackRange = -1
fileprivate var seaAttackRange = -1
fileprivate var airAttackRange = -1
...