3

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?

4

2 に答える 2