Okay, I have a header file I am trying to stub out to my_list.cpp
but I keep getting these errors that I do not understand and have been working down to them but I got stuck.
I figure I'm in deep trouble seeing as I can hardly stub these out, how am I ever going to figure out the actual algorithm for the functions!!
So can I please get some help? Here are the errors printed followed by the provided header file and my code:
Errors

my_list.cpp:116: error: template definition of non-template 'void my_link<T>::operator=(int)'
my_list.cpp:121: error: expected ',' or '...' before '&' token
my_list.cpp:121: error: ISO C++ forbids declaration of 'iterator' with no type
my_list.cpp:121: error: no 'bool my_link<T>::operator==(int) const' member function declared in class 'my_link<T>'
my_list.cpp:121: error: template definition of non-template 'bool my_link<T>::operator==(int) const'
my_list.cpp:126: error: expected ',' or '...' before '&' token
my_list.cpp:126: error: ISO C++ forbids declaration of 'iterator' with no type
my_list.cpp:126: error: no 'bool my_link<T>::operator!=(int) const' member function declared in class 'my_link<T>'
my_list.cpp:126: error: template definition of non-template 'bool my_link<T>::operator!=(int) const'
my_list.cpp:131: error: no 'my_list_iterator<T>& my_link<T>::operator++()' member function declared in class 'my_link<T>'
my_list.cpp:131: error: template definition of non-template 'my_list_iterator<T>& my_link<T>::operator++()'
my_list.cpp:136: error: prototype for 'my_list_iterator<T> my_link<T>::operator++(int)' does not match any in class 'my_link<T>'
my_list.cpp:131: error: candidate is: my_list_iterator<T>& my_link<T>::operator++()
my_list.cpp:136: error: template definition of non-template 'my_list_iterator<T> my_link<T>::operator++(int)'
my_list.cpp:141: error: no 'my_list_iterator<T>& my_link<T>::operator--()' member function declared in class 'my_link<T>'
my_list.cpp:141: error: template definition of non-template 'my_list_iterator<T>& my_link<T>::operator--()'
my_list.cpp:146: error: prototype for 'my_list_iterator<T> my_link<T>::operator--(int)' does not match any in class 'my_link<T>'
my_list.cpp:141: error: candidate is: my_list_iterator<T>& my_link<T>::operator--()
my_list.cpp:146: error: template definition of non-template 'my_list_iterator<T> my_link<T>::operator--(int)'

my_list.h

#ifndef MY_LIST_H
#define MY_LIST_H

// my_list.h  - a doubly-linked list

#include <algorithm>
using namespace std;

// forward declaration of classes defined in this header
template <class T> class my_list;
template <class T> class my_link;
template <class T> class my_list_iterator;

template <class T> 
class my_list
{
public:
   typedef T value_type;
   typedef my_list_iterator<T> iterator;

   // constructors
   my_list();  // no-arg constructor 
   my_list(const my_list & l); // copy constructor

   ~my_list(); // destructor

   // operations
   bool empty() const;
   int size() const;
   T & back() const;
   T & front() const;
   void push_front(const T & x);
   void push_back(const T & x);
   void pop_front();
   void pop_back();
   iterator begin() const;
   iterator end() const;
   void insert(iterator pos, const T & x); // insert x before pos
   void erase(iterator pos);

protected:
   my_link<T> * first_link;
   my_link<T> * last_link;
   unsigned int my_size;
};

template <class T> 
class my_link 
{
private:
   my_link(const T & x);

   T x;
   my_link<T> * next_link;
   my_link<T> * prev_link;

   friend class my_list<T>;
   friend class my_list_iterator<T>;
};

template <class T> class my_list_iterator 
{
public:
   typedef my_list_iterator<T> iterator;

   // constructor
   my_list_iterator(my_link<T> * current_link); 

   // operators
   T & operator*();  // dereferencing operator
   void operator=(const iterator & rhs); 
   bool operator==(const iterator & rhs) const;
   bool operator!=(const iterator & rhs) const;
   iterator & operator++();  // pre-increment, ex. ++it
   iterator operator++(int); // post-increment, ex. it++
   iterator & operator--();  // pre-decrement
   iterator operator--(int); // post-decrement

protected:
   my_link<T> * current_link;
   friend class my_list<T>;
};


#include "my_list.cpp"

#endif

my_list.cpp

#include <iostream>
#include <list>
#include "my_list.h"

using namespace std;

template <class T>
my_list<T>::my_list(){

        my_size = 0;
        T * first_link = NULL;
        T * last_link = NULL;
}

template <class T>
my_list<T>::my_list(const my_list& l){

        first_link = l.first_link;
        last_link = l.last_link;

}

template <class T>
my_list<T>::~my_list(){



}

template <class T>
bool my_list<T>::empty() const{

        if(size() == 0){
                return true;
        }else{
                return false;
        }
}

template <class T>
int my_list<T>::size() const{

        return my_size;
}

template <class T>
T& my_list<T>::back() const{



}

template <class T>
T& my_list<T>::front() const{



}

template <class T>
void my_list<T>::push_front(const T& x){


}

template <class T>
void my_list<T>::push_back(const T& x){


}

template <class T>
void my_list<T>::pop_front(){


}

template <class T>
void my_list<T>::pop_back(){

}

template <class T>
my_list_iterator<T> my_list<T>::begin() const{

}

template <class T>
my_list_iterator<T> my_list<T>::end() const{

}

template <class T>
void my_list<T>::insert(iterator pos, const T& x){

}

template <class T>
void my_list<T>::erase(iterator pos){

}

template <class T>
my_list_iterator<T> my_link<T>::my_list_iterator(my_link<T>* current_link){

}

template <class T>
T& my_link<T>::operator*(){


}

template <class T>
void my_link<T>::operator=(const iterator & rhs){

}

template <class T>
bool my_link<T>::operator==(const iterator& rhs) const{

}

template <class T>
bool my_link<T>::operator!=(const iterator& rhs) const{

}

template <class T>
my_list_iterator<T>& my_link<T>::operator++(){

}

template <class T>
my_list_iterator<T> my_link<T>::operator++(int){

}

template <class T>
my_list_iterator<T>& my_link<T>::operator--(){

}

template <class T>
my_list_iterator<T> my_link<T>::operator--(int){

}

>>How am I ever going to figure out the actual algorithm for the functions!!

Just like everyone else does -- use your compiler's debugger and single-step through the program at runtime.

I got the cpp file stubbed out, turns out I was misreading the header file so I was using the wrong class to call the functions so they didn't exist in that class.

This question has already been answered. Start a new discussion instead.