All pastes #559450 Raw Edit

Sanoz0r

public cpp v1 · immutable
·published 2007-06-11 19:38 UTC
rendered paste body
#ifndef H_MYLINKEDLIST#define H_MYLINKEDLIST#include <iostream>using namespace std;template<class Type>struct nodeType {    Type info;    nodeType<Type> *link;};template<class Type>class MyLinkedList {    friend ostream& operator<<(ostream &sout, const MyLinkedList<Type> &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<Type> *front;        int count;};template<class Type>MyLinkedList<Type>::MyLinkedList() {    front = NULL;}template<class Type>MyLinkedList<Type>::MyLinkedList(const MyLinkedList &list) {}template<class Type>MyLinkedList<Type>::~MyLinkedList() {}template<class Type>void MyLinkedList<Type>::insertBack(const Type &item) {    nodeType<Type> *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<class Type>void MyLinkedList<Type>::insertFront(const Type &item) {}template<class Type>Type MyLinkedList<Type>::operator[](const int &index) {}template<class Type>ostream& operator<<(ostream &sout, const MyLinkedList<Type> &list) {    nodeType<Type> *current = list.front;    while(current != NULL) {        sout << current->info << " ";        current = current->link;    }    return sout;}#endif15 [Warning] friend declaration `std::ostream& operator<<(std::ostream&, const MyLinkedList<Type>&)' declares a non-template function15 [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