|
|
Darren New schrieb:
>
> What I'm doing right now is declaring
> struct _IDirectFB; struct _IDirectFBFont; ...
> class dfbScreen {
> struct _IDirectFB* dfb;
> struct _IDirectFBFont* font;
> ...
> }
>
> But that seems wrong, given that I have to grope around in someone
> else's headers to pull out private declarations to make it possible to
> compile a header that doesn't depend on those declarations.
Yes, that's why you normally /do/ include the headers... after all,
that's what they are for.
I'm not sure, but you might also be able to directly use
struct IDirectFB;
instead of
class IDirectFB;
> The other choice is to make it into a separate class and add another
> level of indirection, but that too seems like a solution to what
> shouldn't be a problem?
Unfortunately, C++ doesn't natively make a good job at separating
interface from implementation (the bane of allowing direct access to
data members, and "inlining" of classes as data members).
Speaking of interfaces, you might make dfbScreen abstract (serving as
what would usually be declared as an interface in Java), so that you can
keep the actual implementation of it in the background - private data
members included.
Post a reply to this message
|
|