Encapsulate the capacity in a method
getCapacity
. That method can look for a TRAM_CAPACITY
or BUS_CAPACITY
static variable depending on which class is implementing it. This way you don't need to care about static variables and inheritance.