One tip you might not be aware of: you could potentially take your From/Into implementation one step further by making the Circle constructor generic over any type that can be converted into a Radius:
This gives you the same nice interface you'd get from function overloading, but without, as you mentioned, having to go back and write a million new functions when you create a new type :) It does come at the expense of making it a little less obvious a conversion is happening, though.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is a really good article, nicely explained!
One tip you might not be aware of: you could potentially take your
From
/Into
implementation one step further by making theCircle
constructor generic over any type that can be converted into aRadius
:This gives you the same nice interface you'd get from function overloading, but without, as you mentioned, having to go back and write a million new functions when you create a new type :) It does come at the expense of making it a little less obvious a conversion is happening, though.