On Saturday, 18 June 2016 at 07:03:25 UTC, cy wrote:
So how would you do it? Defining A.foo, B.foo, etc in one
place, and A.bar, B.bar, etc in another?
No such thing in D. But you can always be creative and use an
overloaded helper function containing the actual implementation
if you want to group the code by functionality and not by type:
class A { int foo() { return doFoo(this); }
class B : A { int foo() { return doFoo(this); }
...
void doFoo(A a) { ... }
void doFoo(B b) { ... }
If you need full access to the members, the helpers would need to
be in the same module, otherwise you can put them into a separate
helper.