Store Class values

Hi,

I have the following scenario:

1
2
3
  int SampleClass::doWork(TCustomType _dataCall, void* _reserved){
    ...
 }


I want to store the value of both parameters (dataCall and reserved) in order to use them in other function. I can't pass this values as parameters to other function.
Just want to store them (maybe into a class variables) to use them later.
How to do it? How to declare this both varibles into class and how to do the assignament?

Hope my explanation be clear as possible...Thanks

B.R!
Do you mean just to declare them as part of the class? That would just be like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class SampleClass {
    public:
        SampleClass() : _dataCall(0), _reserved(nullptr) {}

        int doWork(TCustomType _dataCall, void *_reserved);
        void otherFunc(void);

    private:
        TCustomType _dataCall;
        void *_reserved;
}

int SampleClass::doWork(TCustomType _dataCall, void *_reserved) {
    this->_dataCall = _dataCall;
    this->_reserved = _reserved;

    // ...
}

// Example usage
void SampleClass::otherFunc(void) {
    int num = _dataCall.getSomething(_reserved);
}
Topic archived. No new replies allowed.