C++: Access private member vector of structs from other class

  access, c++, vector

from a similiar question here
I tried the solution

class A {
 ...
  public:

    // Give read-only access to vec_A
    const std::vector<DataStruct> & getVector() const {
        return vec_A;
    }
};

but always get error: ‘DataStruct’ was not declared in this scope.
DataStruct and vec_A are defined in private section , below public section, in same class.

Please, could someone help me.

Regards,
Thomas

Source: StackOverflow C++

LEAVE A COMMENT