How to pass a linc to class function and call it?

Posted by Kabumbus on Stack Overflow See other posts from Stack Overflow or by Kabumbus
Published on 2011-01-15T19:35:58Z Indexed on 2011/01/15 19:53 UTC
Read the original article Hit count: 214

Filed under:
|
|

So I have a class like

class mySafeData
{
public:
    void Set( int i ) 
    {
        myMutex.lock();
        myData = i;
        myMutex.unlock();
    }
    void Get( int& i)
    {
        myMutex.lock();
        i = myData;
        myMutex.unlock();
    }
private:
    int myData;
    boost::mutex myMutex;

};

its instance is running. Lets call instance A. I want to create a new class that would take as a start up argument some kind of link to Getter from A and would be capable to somehow save link to thet getter for calling it inside its private methods vhen needed. how to do such thing?

© Stack Overflow or respective owner

Related posts about c++

Related posts about oop