I have following setup: superclass Vehicle
with atribute capacity
and two subclasses Bus
and Tram
. All trams have the same capacity as well as all busus (it should be static atribute), but capacity of a tram may be different from capacity of a bus. How to implemnt such approach in Java?
I have partially solved the problem just ignoring the fact that capacity should be static attribute for all subclasses (no static atributes).
Michał Stachurski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.