3 ms·
The first part seems the wrong way to do it (treating it as an example). You would presumably overload area() on the object type, not on individual parameters r
by throwaway_pdp09 7y ago
The first part seems the wrong way to do it (treating it as an example). You would presumably overload area() on the object type, not on individual parameters representing the object's geometry. 'circle.area(r)' is even weirder - extracting radius just doesn't make sense here.
<SomeGeometricObject>.area() is right AFAICS.
Which I think is what you're getting at anyway.
But IMO overloading used right is cleaner than not having overloading.
- BiteCode_dev 7y ago> 'circle.area(r)' is even weirder It's just putting the original area() function in a module, not making it a method of a class. It's the simplest solution you can have, ever. Adding an object is already more complex, and complexity needs to be justified. Just KISS if you can.