For example,
class GetDepth_Class {
    public:
        vector<int> positionX, positionY;
        vector<int>::iterator it;
        int getDepth();
    };
int GetDepth_Class::getDepth(){
                ......
                ......
                if (scalar[0] == 0 && scalar[1] == 0 && scalar[2] == 0) {
                    it = positionX.begin();
                    positionX.insert(it, i + 80);
                    it = positionY.begin();
                    positionY.insert(it, j + 80);
                }
                for (int i = 0; i < positionX.size(); i++) {
                    cout << positionX[i] << "," << positionY[i] << endl;
                }
return EXIT_SUCCESS;//realsense depth camera module
}
    int main() {
    GetDepth_Class Obj;
    Obj.getDepth();
    //Here I would like to access the values of vector positionX and vector positionY output from GetDepth_Class::getDepth(), 
    //how should I do if I want to avoid using global variable?
}
I would like to access the values of vector positionX and vector positionY output from getDepth() in main(), and I want to avoid using global varible. Is there any solution for it?
Thanks
 
     
    