myvector myvector :: operator+(const myvector &ref) const
{
myvector e(ref.size);
int i;
for (i=0; i<ref.size; i++) ///ref.size error :reference to
///non-static member function must be called
{
e[i] = this ->arr[i] + ref.arr[i];
}
return e;
}
header file
1 2 3 4 5 6 7 8 9 10 11 12 13
class myvector{
public:
double * arr;
int arrlen;
double xpos, ypos;
myvector();
myvector(int size);
int size();
double norm();
void resize(int newsize);