3 ms·
Parent proposed a wrapper, rather than an alias. One way to handle this with an Angle type is to not allow an automatic cast from float/double/int. instead, yo
by ratorx 4y ago
Parent proposed a wrapper, rather than an alias.
One way to handle this with an Angle type is to not allow an automatic cast from float/double/int. instead, you expose methods that normalise the input and internally can represent it as whatever, i.e. from_degrees, from_turns, from_radians or similar that force the programmer to be explicit about their unit, when the angle is constructed.
Alternatively, Angle could be the base class and each unit gets its own class that Angle inherits from.