5 ms·
Some languages provide you with a mechanism to deal with that (c#s properties), and many others allow you to get a similar result with function overloading. So
by mnx 12y ago
Some languages provide you with a mechanism to deal with that (c#s properties), and many others allow you to get a similar result with function overloading. So you don't have getX() and setX(), you have X(), and X(int x)
- laumars 12y agoWhile function overloading is a neat trick, I think it's a step backwards in terms of code readability. In those instances, it's only clear from the usage rather than the name how that function behaves, so I think I'd rather see getX and setX over X() and X(int x) and be absolutely clear about the role of that function.