Hi there,
I have one class (MyClassA), with a method draw() from this method I am trying to access an instance of MyClassB. The instance has a variable v[X] and v[Y] which I need to access but can't because it is declared as private... Is this possible via pointers?
Could anyone also explain what & does?
Really keen to find out what the problem is here :/
MyClassA.cpp
void MyClassA::set(MyClassB*& inc){
myVert=new MyClassB[n];
for(int j=0;j<NUM;j++) myVert[i]=inc[i];
}
void MyClassA::draw(){
//LINE BELOW WHERE ERROR IS, Compile error : v is private.
int lol = myVert[0].v[X];
}
MyClassB.h
class MyClassB {
public:
MyClassB(const MyClassB& v);
private:
float *v;
};