new to operator overloading and I'm getting an unresolved exteneral error message when trying to operator overload with <<. Error LNK1120 and 2019. Anyone know why? Thank you!
template <class Type>
class ListType {
public:
..
friend std::ostream& operator<< (std::ostream&, const ListType &);
};
template <class Type>
std::ostream& operator<< (std::ostream& out, const ListType<Type>& list) {
if (list.head) {
NodeType<Type> *temp = list.head;
out << list.head->item;
temp = temp->next;
while (temp != 0) {
out << "," << temp->item;
temp = temp->next;
}
}
return out;
}