Re:Be wary of functions which take several parameters of the...
by GarvielLoken on Friday September 27, 2019 @03:44AM
(#21089456)
new File().Source("xyz").CopyTo("zyx") is the cleanest I believe, and also the most (real) OO way.
[ Parent
| on HN ]
Re:Be wary of functions which take several parameters of the...
by DarkWiiPlayer on Friday September 27, 2019 @08:30AM
(#21091137)
> and also the most (real) OO way.
No. Far from it. First of all, what is File in your example? a class? an object? and what does File().Source() return? an object? what does that object represent?
If you want it to be OO, you have a File object, to which you send a "copy" message. Depending on how strictly OO you want it to be, it then returns the new file object (or a reference to it).