Hi everyone.I am trying to overload operator [].This is the following problem.
In class Vector.h i have
1 2 3 4 5
class{
private:Point *vector;
int dim;//for dimension
//I did not write all functions and constructors only code for the question
};
In point.h under public i have define operator[] like this
int& operator[](int i);.Now in Point.cpp(i have included point.h) i have
1 2 3 4 5 6 7 8 9 10
//only code for the question
int& Point::operator[](constint index)
{
return vector[index];//says vector is not defined
//I was thinking i could get vector from class vector because array vector
//has it's elements from class Point
}