Реализация односвязного списка c++

Реализовал односвязный список, все как в гайде, при компиляции возникают ошибки. Ниже сама реализация: MyList.h :

#ifndef MyList_h
#define MyList_h

#include <iostream>
template <typename T>
   class Node {
   public:
       T data;
       Node *pNext;
       Node (T data = T(), Node *pNext = nullptr ) {
           this -> data = data;
           this -> pNext = pNext;
       }
   };
template <typename T>
class MyList : public Node<T> {
private:
    int size;
    Node <T> *head;

public:
    MyList();
    ~MyList();
    void pushBack (T data);

};

#endif /* MyList_h */

MyList.cpp:

#include "MyList.h"
template <typename T>
MyList<T> :: MyList () {
    size = 0;
    head = nullptr;
}
template <typename T>
void MyList<T> :: pushBack(T data) {
    if (head == nullptr) {
        head = new Node <T>(data);
    }
    else {

    }

}

template <typename T>
MyList<T> ::~MyList() {

}

Main:

#include "MyList.h"
int main() {
    MyList <int> lst;
    lst.pushBack(4);
    return 0;
}

При компиляции возникает ошибка :

Undefined symbol: MyList::pushBack(int)

Undefined symbol: MyList::MyList()

Undefined symbol: MyList::~MyList()


Ответы (0 шт):