I am having some trouble with templates. for some reason my template itself seems to be fine but when I try to use it for some reason it errors out even though as far as I know I am using it correctly. The template is for a simple linked list that is meant to hold a child Shape classes and a CustomShape class. This code is for school so if you could only comment on the errors related to the template that would be great. I have read other posts on this subject but none seem to help/solve whatever my issue is.
Errors using Visual Studio 2015:
1>------ Build started: Project: a2_warn1700, Configuration: Debug Win32 ------
1>  LinkedList.cpp
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C2143: syntax error: missing ';' before '<'
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C2238: unexpected token(s) preceding ';'
1>  Generating Code...
1>  Compiling...
1>  CustomShape.cpp
1>  Generating Code...
1>  Compiling...
1>  main.cpp
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C2143: syntax error: missing ';' before '<'
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C2238: unexpected token(s) preceding ';'
1>  World.cpp
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C2143: syntax error: missing ';' before '<'
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(14): error C2238: unexpected token(s) preceding ';'
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(17): error C2039: 'shapeComponents': is not a member of 'CustomShape'
1>  c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(9): note: see declaration of 'CustomShape'
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(17): error C2228: left of '.isNext' must have class/struct/union
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(18): error C2039: 'shapeComponents': is not a member of 'CustomShape'
1>  c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\customshape.h(9): note: see declaration of 'CustomShape'
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(18): error C2228: left of '.next' must have class/struct/union
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(19): error C3536: 'shape': cannot be used before it is initialized
1>c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(19): error C2227: left of '->draw' must point to class/struct/union/generic type
1>  c:\users\user\documents\laurier\fall 2016\cp411\a2_warn1700\a2_warn1700\world.cpp(19): note: type is 'int'
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
LinkedList.cpp
#include "LinkedList.h"
template <class T> void LinkedList<T>::insert(T* newObject) {
    if (size == 0) {
        size++;
        root = new LinkedList::Node();
        root->obj = newObject;
        lastNode = root;
        currentNode = root;
    }
    else {
        LinkedList::Node *nextNode = root;
        while (nextNode->next != nullptr) {
            nextNode = nextNode->next;
        }
        LinkedList::Node *prevNode = nextNode;
        nextNode->next = new LinkedList::Node();
        nextNode = nextNode->next;
        nextNode->prev = prevNode;
        nextNode->obj = newObject;
        lastNode = nextNode;
    }
}
template <class T> typename T* LinkedList<T>::next() {
    T* object;
    if (currentNode != nullptr) {
        object = currentNode->obj;
        currentNode = currentNode->next;
    }
    return object;
}
template <class T> bool LinkedList<T>::isNext() {
    bool moreVal = false;
    // check if there are more values
    if (currentNode != nullptr) {
        moreVal = true;
    }
    else {
        currentNode = root;
    }
    return moreVal;
}
template <class T> void LinkedList<T>::destroy() {
    Node *nextNode = root;
    while (nextNode->next != nullptr) {
        Node *temp = nextNode;
        nextNode = nextNode->next;
        delete temp;
    }
    delete root;
    delete currentNode;
    delete lastNode;
    size = 0;
    root = new Node();
    currentNode = root;
    lastNode = root;
}
template <class T> typename T* LinkedList<T>::getRoot() {
    T* object = this->root->obj;
    return object;
}
template class LinkedList<Shape>;
template class LinkedList<CustomShape>;
LinkedList.h
#pragma once
#include "Shape.h"
#include "CustomShape.h"
template <class T>
class LinkedList
{
public:
    LinkedList<T>::LinkedList() {};
    LinkedList<T>::~LinkedList() {};
    void insert(T* newObject);
    T* next();
    bool isNext();
    void destroy();
    T* getRoot();
private:
    struct Node {
        T* obj;
        Node* next = nullptr;
        Node* prev = nullptr;
    };
    int size = 0;
    Node *root = nullptr;
    Node *lastNode = nullptr;
    Node *currentNode = nullptr;
};
World.h
#pragma once
#include "LinkedList.h"
#include "Shape.h"
#include "Cube.h"
#include "CustomShape.h"
#include <iostream>
class World
{
public:
    World();
    ~World();
    void drawWorld();
private:
    LinkedList<CustomShape> worldObjects;
};
World.cpp
    #include "World.h"
    World::World() {
        CustomShape* cShape = new CustomShape();
        cShape->insertShape(new Cube);
        worldObjects.insert(cShape);
    }
    World::~World() {
        this->worldObjects.destroy();
    }
    void World::drawWorld() {
        while (worldObjects.isNext()) {
            auto cShape = worldObjects.next();
            while (cShape->shapeComponents.isNext()) {
                auto shape = cShape->shapeComponents.next();
                shape->draw();
            }
        }
    }
CustomShape.h
#pragma once
#include "GL\glut.h"
#include "LinkedList.h"
#include "Point.h"
#include "Shape.h"
class CustomShape
{
public:
    CustomShape();
    ~CustomShape();
    void insertShape(Shape* shape);
    LinkedList<Shape> shapeComponents;
    void drawSelected();
    Point originPoint;
};
Thanks in advance.
