Question: G'day guys, so I've decided to utilise generalisation for a UDT library to make further projects easier, however I've hit a snag regarding the declaration and specific syntax despite scouring the internet for possible answers to my conundrum.

Firstly, I have the following two shell classes, both template:

```
//Nodes.h
#pragma once
#include "LinkedList.h"

template <class T>
class LLNode
{
    LLNode(T _data, LinkedList* parent);

    private:
        T data;
        LLNode* next;
};

```

And

```
//LinkedList.h
#pragma once
#include "Nodes.h"

template <class T> 
class LinkedList
{
    LLNode* first;
    LLNode* last;
    int size;

    LinkedList(T data);

    void insert(T data, int index);
    void append(T data);

    void insert(LLNode* node, int index);
    void append(LLNode* node);
};

```

Now, the problem is that no matter what I do, I can't seem to resolve the following error:
"error C2601: syntax error: identifier 'LinkedList'" regarding the constructor shell for the LLNode template.

My main question is how do you, if possible, use template classes as a parameter type and what syntactic errors am I overlooking regarding the rest?

Answer: 
First, `LLNode` is a class template, so you need

```
 LLNode<T>* first;

void insert(LLNode<T>* node, int index);

```

and so on.

Second, you have a cyclic include dependency between `Nodes.h` and `LinkedList.h`. You will have to re-design your code such that the classes don't depend on each other, or use forward declarations. You might have to play around with where you place the includes, which will be required for the implementations of your member functions. I suggest a re-design.
You need to use the template type for `LLNode`, e.g.

```
void insert(LLNode<T>* node, int index);

```

As well as declare the member variables using the template type:

```
LLNode<T>* first;

```

---

You also have a circular include dependency. The header file `Nodes.h` needs `LinkedList.h` which needs `Nodes.h` etc. You can probably overcome it by *declaring* `LinkedList` in the `Nodes.h` header file, instead of the current inclusion of the `LinkedList.h` header file:

```
template<typename T>
class LinkedList;

template<typename T>
class LLNode
{
    ...
};

```

You may have to include the `LinkedList.h` header file in `Nodes.h` anyway, depending on how you use the list class from the node class.

And no, the `#pragma once` or include guards doesn't help for this, as `LinkedList` needs `LLNode` to be declared before `LinkedList` and the other way around.