pImpl in D
Satoshi via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 4 05:05:15 PDT 2017
Hi,
do someone have any experience with pImpl and inheritance in D?
I tried something like:
// FooPrivate.d
class FooPrivate {
int a;
}
// BarPrivate.d
import FooPivate;
class BarPrivate : FooPrivate {
string b;
}
// Foo.d
import FooPrivate;
class Foo {
protected FooPrivate m_private;
this() { m_private = new FooPrivate; }
}
// Bar.d
import Foo;
import FooPrivate;
import BarPrivate;
class Bar : Foo {
this() { m_private = new BarPrivate; }
}
And public interface
// Foo.di
class FooPrivate;
class Foo {
private FooPrivate m_private;
}
Bar.d looks like it imported Foo with forward referenced
FooPrivate and is unable to resolve it by importing FooPrivate.
Is this bug?
Do you know about any *less verbose* design pattern how I can
hide implementaion details from .di files?
Thanks!
More information about the Digitalmars-d
mailing list