A.d: ---- import B; class Foo { public: void call(Bar b) { b.test(42); } }
void main() { Bar b = new Bar(); Foo f = new Foo(); f.call(b); } ---- B.d: ---- import std.stdio; class Bar { private: void test(int id) { writeln("Bar called with ", id); } } ---- As expected: Output: A.d(6): Error: class B.Bar member test is not accessible But with this little change of A's Foo class: ---- class Foo { public: void call(Bar b) { void delegate(int) dg = &b.test; dg(42); } } ---- It works: Bar.bar with 42 Bug or feature? :P