Thanks, I found that and it wasn't very useful.
However I stumbled upon this
http://techbase.kde.org/Policies/Lib...icy#D-Pointers
and
http://techbase.kde.org/Policies/Lib...ointer_Example
which bring alot of clarity to the issue.
However I have another question now.
In the second link above the example will basically never have private member variables in the 'KFooBase' but rather put them into the public: 'KFooBasePrivate' class.
also in this part of code
class KFooBasePrivate
{
public:
virtual ~KFooBasePrivate() { }
int someInteger;
};
class KFooBasePrivate
{
public:
virtual ~KFooBasePrivate() { }
int someInteger;
};
To copy to clipboard, switch view to plain text mode
why not do this
class KFooBase
{
public:
...the same as example...
private:
//Get rid of this stuff
//friend class KFooBasePrivate;
//inline KFooBasePrivate *d_func() { return d_ptr; }
//inline const KFooBasePrivate *d_func() const { return d_ptr; }
int someInteger;
};
class KFooBase
{
public:
...the same as example...
private:
//Get rid of this stuff
//friend class KFooBasePrivate;
//inline KFooBasePrivate *d_func() { return d_ptr; }
//inline const KFooBasePrivate *d_func() const { return d_ptr; }
int someInteger;
};
To copy to clipboard, switch view to plain text mode
I guess at the moment, I don't see the reason to go through all this trouble to make a "Private" class, to have member variables in there, when perhaps you could have just ignored this d_ptr stuff and used the private tag? Through lots of my reading today i read that it is best to use this method and not put private member variables in the private: part of a class, but they gave me no reason.
Bookmarks