/// <summary> /// Adds a wheel to the vehicle. /// </summary> /// <param name="wheel">WheelTest to add.</param> public void AddWheel(Wheel wheel) { if (wheel.vehicle == null) { Wheels.Add(wheel); wheel.OnAddedToVehicle(this); } else { throw new InvalidOperationException("Can't add a wheel to a vehicle if it already belongs to a vehicle."); } }
/// <summary> /// Adds a wheel to the vehicle. /// </summary> /// <param name="wheel">WheelTest to add.</param> public void AddWheel(Wheel wheel) { if (wheel.vehicle == null) { Wheels.Add(wheel); wheel.OnAddedToVehicle(this); } else throw new InvalidOperationException("Can't add a wheel to a vehicle if it already belongs to a vehicle."); }