Modify an object without using it as parameter

Posted by Claire Huang on Stack Overflow See other posts from Stack Overflow or by Claire Huang
Published on 2010-05-17T23:41:44Z Indexed on 2010/05/18 0:20 UTC
Read the original article Hit count: 506

Filed under:
|
|

I have a global object "X" and a class "A". I need a function F in A which have the ability to modify the content of X.

For some reason, X cannot be a data member of A (but A can contain some member Y as reference of X), and also, F cannot have any parameter, so I cannot pass X as an parameter into F. (Here A is an dialog and F is a slot without any parameter, such as accept() )

How can I modify X within F if I cannot pass X into it? Is there any way to let A know that "X" is the object it need to modify?? I try to add something such as SetItem to specify X in A, but failed.

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt