You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example: We have a some_distance instance of Distance, and we want to double it.
Here is one kludge: Distance(2*some_distance.raw_value, Distance.Inch) << some_distance.unit
Problem: We have to read through the Distance class to see that its raw_value is in units of Distance.Inch.
Solution: Give all AbstractUnits child classes a raw_units property (can be static) that returns the raw units for the subclass. For example, Distance.raw_units would return Distance.Inch. Then we could instead do: Distance(2*some_distance.raw_value, some_distance.raw_units) << some_distance.unit
The text was updated successfully, but these errors were encountered: