[Dev-C++] I've never seen this one before.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Opacki, J. <Jos...@ng...> - 2003-10-16 17:46:27
|
Can someone tell me if they see something blatantly obvious.
My compile.log relays the following, please note I have wrapped my class def
in my own namespace(opacki):
warning: friend declaration `std::ostream&
opacki::operator<<(std::ostream&, const opacki::List<ItemType>&)'
declares a non-template function
// function type inside my class declaration //
friend ostream& operator <<(ostream& outs, const List<ItemType>& theList);
// full function in my implementation template //
template<class ItemType>
ostream& operator <<(ostream& outs, const List<ItemType>& theList)
{
for ( int i = 0; i < theList.currentLength; i++ )
{
outs << theList.item[i] << endl;
}
return outs;
}
// inside main() //
List<int> firstList(2);
firstList.add(1);
firstList.add(2);
cout << "first list = " << firstList;
// ^ error occurs here //
|