Don't worry, we aren't trying to change this from a byond forum to a C++ forum but I just thought I'd give it a try since the only C++ help forum that I've used shut down a while ago :p
We've just started using C++ class templates and I've been having some trouble overloading the insertion operator:
template
ostream& operator <<(ostream& outs, const List& the_list){
for(int i = 0; i < the_list.current_length; i++){
outs << the_list.item[i] << endl;
}
return outs;
}
I have that listed as a public friend function inside my List class but I get this really weird "Undefined symbol" error when I try to do this:
int main(){
List testlist(2);
testlist.add(3);
cout << testlist; //when this line is removed I don't get the error
return 0;
}
The strange thing is that I coppied this from my book so it seems like it should work...</<></<></<>
ID:192871
May 4 2002, 3:59 pm (Edited on May 4 2002, 4:24 pm)
|
|
o.O
O.o
0.o
o.0
O.0
0.O
etc...