/* * It's your choice. You may prefer to use a setter * method instead of using a constructor. * You can call this method whenever we want * to change the "vehicle behavior" on the fly. */ public void SetVehicleBehavior(VehicleBehavior behavior) { this.behavior = behavior; }
public Vehicle(string vehicleType) { this.vehicleType = vehicleType; //Setting the initial behavior this.behavior = new InitialBehavior(); }