I'm trying to overload the ostream operator << and the debugger gave me an error that I have no idea how to fix... any ideas? Thanks in advance.
ptr[] is a pointer to an array of doubles...
Here is my definition for <<... it is a friend function to the Set class
ostream& operator<< (ostream& out, const Set& a) {
for (Node* ptr = a.firstPtr->nextPtr; ptr != 0; ptr = ptr->nextPtr) {
for (int i = 0; i < a.setSize; i++) {
out << ptr;
out << " ";
}
out << endl;
}
out << endl;
return out;
}
And here is the error message...
Error : illegal operands 'std::basic_ostream<char, std::char_traits<char>>' << 'Node'
PA4.cpp line 72 out << ptr;
ptr[] is a pointer to an array of doubles...
Here is my definition for <<... it is a friend function to the Set class
ostream& operator<< (ostream& out, const Set& a) {
for (Node* ptr = a.firstPtr->nextPtr; ptr != 0; ptr = ptr->nextPtr) {
for (int i = 0; i < a.setSize; i++) {
out << ptr;
out << " ";
}
out << endl;
}
out << endl;
return out;
}
And here is the error message...
Error : illegal operands 'std::basic_ostream<char, std::char_traits<char>>' << 'Node'
PA4.cpp line 72 out << ptr;
