Problem using overloaded << operator
Hello,
I am currently creating a class to represent a PolyLine. I have all my methods working correctly, but I need to make an overloaded << operator. Here is the method I am using for testing purposes:
Code:
void output() {
int finalSpot = length - 1;
for (int i = 0; i < finalSpot; i++)
cout << "(" << x[i] << "," << y[i] << "):";
cout << "(" << x[finalSpot] << "," << y[finalSpot] << ")" << endl;
}
The x and y arrays are variables of the PolyLine. They are declared as follows in my class:
Code:
double *x;
double *y;
What would the ostream method equivalent of my output method be? I've tried a number of things and none of them worked. Can someone please help me? Thanks.