Usually method overloads delegate their parameters to the more detailed overloads with default values. here is an example
A(x) => A(x, null);
A(x, y) => A(x, y, null);
A(x, y, z) => ...;
What should I do if i want to override this method and do a little modification before calling the base method?
If I override only the most detailed overload, then I'm relying on implementation details of parent. if later, parent doesn't delegate all overloads to the most detailed overload then my implementation breaks (doesn't do what I intended).
override A(x, y, z) => base.A(foo(x), y, z);
If I override all overloads then I have to copy default parameters used in the base method. my implementation doesn't break, how ever it can be different from parent later on.
override A(x) => A(x, null);
override A(x, y) => A(x, y, null);
override A(x, y, z) => base.A(foo(x), y, z);
which one is correct?