I am having a problem writing the nodes for the list. I want to return the pointer to the next node but i am getting errors
Node.h :
Node.cpp :
error is at line 20 -------> Node* Node::getNext() {
Node.h :
Code:
#ifndef Node_H
#define Node_H
template <typename T>
class Node {
private:
Node* ptr; //points to the next node;
T* obj; //value to be stored within the node;
public:
//constructors
Node(T* theObj, Node* ptr);
//copy constructor
Node(Node& n);
T* getNext();
T* getObj();
};
#endif
Node.cpp :
Code:
#include "Node.h"
template<typename T>
Node<T>::Node(T* theObj, Node* thePtr){
obj = theObj;
ptr = thePtr;
}
template<typename T>
Node<T>::Node(Node& n) {
ptr = n.getNext;
obj = n.getObj;
}
template<typename T>
T* Node<T>::getObj() {
return obj;
}
Node* Node::getNext() {
return ptr;
}
error is at line 20 -------> Node* Node::getNext() {