I want to directly access the vector BigArray::v
which is a class member, and print it out. But the compiler won't build my code:
#include <iostream>
#include <vector>
using namespace std;
class BigArray
{
private:
vector<int> v={1,2,3,4,5,6,7,8,9,10};
int accessCounter;
public:
const vector<int> & getVector() const {return v;}
};
int main(int argc, const char * argv[]) {
// insert code here...
BigArray b;
cout<< *b.getVector()<< endl;
return 0;
}