The reason that you want to use
CoolingMachines cm = new Refrigerator();
is that you can later easily use a different CoolingMachines
. You only need to change that one line of code and the rest of the code will still work (as it will only use methods of CoolingMachines
, which is more general than a specific machine, such as a Refrigerator
).
So for a particular instance of Refrigerator
, the calls cm.start();
and rf.start()
work the same way but cm
might also be a different CoolingMachines
object. And that object could have a different implementation of start()
.