Thinking about a good UML Scheme (need help)

Hello,

I’m new to UML and designing :slight_smile:
I’m designing a UML scheme for vehicles and stuff,

My first concern is that i will have several kinds of vehicles (car, trucks, bicycle, and later maybe boats)
but as you know is that cars and trucks have a licenseplate number, chassisnumber, so things that a bicycle doesn’t have.

I was thinking of making an abstract class “Vehicle” and make subclasses for car and truck and bicycle.
But if I do it this way i will have to add the attributes like license plate to the abstract Vehicle class, but this way a bike will also have this attribute when he will inherit from vehicle, and this sounds kinds of silly to me

I also was thinking about making vehicle an interface, but then i have to add the attribute license plate to car and again to the class truck, which is not good i think…

does somebody has an idea of solving this in a proper way?

Thanks in advance

My initial thought is to keep the Vehicle abstract class and have MotorVehicle as a child. Then cars, trucks, and boats can inherit from MotorVehicle, which can have the LicencePlate attribute shared across motorised vehicles and bicycle can inherit directly from Vehicle. You could even further divide it down so that HumanPoweredVehicle is a child of Vehicle and bicycle inherits from that.