I'm just looking at some example QT code, and I notice that someties in the header file there will be something like so:
class MyClassPrivate;
{
public:
...other non relevant stuff...
protected:
MyClassPrivate *const ptr;
MyClass
( MyClassPrivate
&the_ptr,
QObject *parent
= 0 );
private:
Q_DECLARE_PRIVATE( MyClass );
};
class MyClassPrivate;
class MyClass : public QObject
{
public:
MyClass( QObject *parent = 0 );
...other non relevant stuff...
protected:
MyClassPrivate *const ptr;
MyClass( MyClassPrivate &the_ptr, QObject *parent = 0 );
private:
Q_DECLARE_PRIVATE( MyClass );
};
To copy to clipboard, switch view to plain text mode
I'm just curious what does this "macro" do? Does it offer the ability to have a private version of the class? Why do they want a separate Protected Constructor? Can somebody give me an example why it is useful?
Thanks,
Michael
Bookmarks