On Wednesday 17 August 2011 09.24.31 Alexander Potashev wrote: > >> If I'll add just a forward declaration like "class NoteInfoPrivate;" >> and a "NoteInfoPrivate *p;" into the NoteInfo class, will it be OK?> > > I guess you mean using a d-pointer, yes, that's the suggested way of > > dealing with this kind of issue. > So, the NoteInfoPrivate class may not have any declaration (except for > the forward declaration) until it will be necessary, right?
The concept of a d-pointer is a bit weird at first, for sure ;) You may want to take a peek at some examples to see how its done and steal some patterns of usage. Most C++ libraries use this, but I suggest to take a look at kdelibs for inspiration. And to answer your question; yes, its Ok to just have a forward declaration in the header file.