package net.doorstuck.vehicles protocol Vehicle - startup - shutdown - nrWheels - nrDoors - turn(direction:dir) - accelerate(direction:dir) - velocity end class Car - startup self.engineRunning = true end - shutdown self.engineRunning = false end - nrWheels ^4 end - nrDoors ^4 end - turn(direction:dir) self.currentDirection = dir end - accelerate(direction:dir) match dir #forward => self.currentVelocity += 1, #backward => self.currentVelocity -= 1, end end - velicity ^self.currentVelocity end end