I am making a UML for a set of train cars, specifically:
Locomotive (motorized car that contains an array of all of the connected cars) BoxCar (carries boxes/animals/cargo) RefrigeratorCar (carries food)
I made an abstract class called RailCar that the Locomotive, BoxCar, and RefrigeratorCar all extend. So here is the problem, the Locomotive is related to the RailCar by inheritance and also possesses a has-a (aggregation) relationship with numerous RailCars.
Is this a bad design? If it is, how would you correctly represent the locomotive in a UML since it has an inheritance and aggregation relationship with the same class?