Exercise 2

1 Inheritance through Modification


Declare a
Real variable temp with the unit "degC" in the class Temperature.




Use short class definition and create a new class Temp20 that modifies the variable temp in Temperature to be equal to 20.




Do the same thing as in Temp20, but this time Temp20 should inherit from Temperature.



1.1 Hint

The variable temp must be a parameter so it can be modified in the short class definition.


1.2




1.2.1 Flattening of Temperature, Temp20 and Temp20b