ok, a little layout... polynomial is a class, with two components, coefficientsPtr, a dynamic float array that contains the coefficients to the polynomial; and degree, an int number which is the degree of the polynomial.
i'm doing operator overloading here.
float& operator[] (int i); // the ith coefficient of f() is f
const float& operator[] (int i) const; // read-only version
are the function definitions.
for the first function, i just did
float& Polynomial:
perator[](int i)
{
return coefficientsPtr;
}
the second fuction is supposed to be a read only overload of []. what am i supposed to do different?
i swear, i've been working on this damn program for the past three days and dont know how to do it...
i'm doing operator overloading here.
float& operator[] (int i); // the ith coefficient of f() is f
const float& operator[] (int i) const; // read-only version
are the function definitions.
for the first function, i just did
float& Polynomial:
{
return coefficientsPtr;
}
the second fuction is supposed to be a read only overload of []. what am i supposed to do different?
i swear, i've been working on this damn program for the past three days and dont know how to do it...
