[Qt-interest] Accessing a class member from an operator

John Weeks john at wavemetrics.com
Thu Apr 22 19:53:01 CEST 2010


On Apr 22, 2010, at 10:27 AM, Oliver Heins wrote:

> I call the QDataStream &operator>> within Editor::readFile().  So  
> there
> is an instance of Editor when the operator is called.

But QDataStream &operator>> is not a member function, so it lacks the  
implied this-> pointer. It can't access member functions without  
explicit knowledge of the instance.

I think the way you have declared QDataStream &operator>>, you must  
read it into an object of type Token. Then within readfile(), where  
you *do* have access to this-> for Editor, you would put the Token  
into partnerMap.

Regards, John Weeks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100422/70fdd1e8/attachment.html 


More information about the Qt-interest-old mailing list