I am have a problem with my Node class, I created the interface and implementation files of the class. When I build it, this error occurs: "error: redeclaration of 'Node::Node(const T&, Node, N ode)' may not have default arguments [-fpermissive] Node::Node(const T &item = T(), Node *nxt = NULL, Node *bck = NULL)".
My Interface
#ifndef NODE_HPP
#define NODE_HPP
#include <iostream>
using namespace std;
template <typename T>
class Node {
public:
T item;
Node<T> *next;
Node<T> *back;
Node(const T &item = T(), Node<T> *nxt = NULL, Node<T> *bck = NULL); };
#endif
and My implementation code
#include "Node.hpp"
template <typename T>
Node<T>::Node(const T &item = T(), Node<T> *nxt = NULL, Node<T> *bck = NULL)
{
this->item = item;
next = nxt;
back = bck;
}
SOLVED
I changed my implementation code like this and Solved.
#include "Node.hpp"
template <typename T>
Node<T>::Node(const T &item, Node<T> *nxt, Node<T> *bck)
{
this->item = item;
next = nxt;
back = bck;
}