Dec-07-2017, 03:21 PM
I think @Mekire provided the answer I was looking for. Which brings me to another question, if getter/setters shouldn't be used, how do I indicate to someone using my code that they should treat a variable as "cannot be set after construction, but you can get it"? or In other words, it's initialized when you create the object, but can't be changed afterward(so no setters), but you can get the value that you gave in the constructor.
I don't think
I don't think
Tire
should be a subclass of Car
. Inheritance indicates a "is-a" relationship. A Tire
is not Car
, an Engine
is not a Car
, but they're components of a Car
. A Car
has an Engine
, A Car
has a set of Tires
.