PDA

View Full Version : private classes in QT



talk2amulya
19th February 2009, 14:05
hi,

while going through the source of QT, i saw that they use private data classes for many of their classes, for ee.g. QMainWindow uss a QMainWindowPrivate..what is it used for..why such seperation of data members..my only guess in implicit data sharing..is that why they r there or some other multiple reason..any input would be greatly appreciated.

Thanks!

Lykurg
19th February 2009, 14:44
The magic word is pimpl!

http://en.wikipedia.org/wiki/Pimpl
In computer programming, an opaque pointer is a datatype that hides its internal implementation using a pointer. This allows the implementation of the whole interface to change without the need to recompile the modules using it. This is important for providing binary code compatibility through different versions of a shared library, for example.

talk2amulya
19th February 2009, 14:52
oh thanks a lot for that! so that means, this has no significance to implicit data sharing? cuz in assistant, i saw an example of QSharedData and QSharedDataPointer where they did kind of the same thing to implement implicit data sharing..so is it possible that its used for multiple purposes?

aamer4yu
19th February 2009, 18:26
This link (http://techbase.kde.org/Policies/Library_Code_Policy#D-Pointers) might be useful :)