#ifndef H_MYLINKEDLIST #define H_MYLINKEDLIST #include using namespace std; template struct nodeType { Type info; nodeType *link; }; template class MyLinkedList { friend ostream& operator<<(ostream &sout, const MyLinkedList &list); public: MyLinkedList(); MyLinkedList(const MyLinkedList &list); ~MyLinkedList(); void insertBack(const Type &item); void insertFront(const Type &item); Type operator[](const int &index); protected: nodeType *front; int count; }; template MyLinkedList::MyLinkedList() { front = NULL; } template MyLinkedList::MyLinkedList(const MyLinkedList &list) {} template MyLinkedList::~MyLinkedList() {} template void MyLinkedList::insertBack(const Type &item) { nodeType *newItem, *current = front; newItem->info = item; newItem->link = NULL; if(front == NULL) front = newItem; else { while(current != NULL) current = current->link; current->link = newItem; } } template void MyLinkedList::insertFront(const Type &item) {} template Type MyLinkedList::operator[](const int &index) {} template ostream& operator<<(ostream &sout, const MyLinkedList &list) { nodeType *current = list.front; while(current != NULL) { sout << current->info << " "; current = current->link; } return sout; } #endif 15 [Warning] friend declaration `std::ostream& operator<<(std::ostream&, const MyLinkedList&)' declares a non-template function 15 [Warning] (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning