Error in linked list template class

class Node
{
public:
Node();
void insertnode(int data);
void deletenode(int index);
void printnode();
void sortnode();
Node<t>* fetchnodeatindex(int index);
private:
t data;
int index;
Node<t>* next;
};
typedef Node<t>* nodeptr; <--Error is here
#endif /* Node_h */ //
Hey everyone,
Can someone please explain to me why I am receiving an error here?
Thank you so much
Note: I highlighted the text and pressed code but it doesn't want to change
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
template <class t>
class Node
{
public:
Node();
void insertnode(int data);
void deletenode(int index);
void printnode();
void sortnode();
Node<t>* fetchnodeatindex(int index);
private:
t data;
int index;
Node<t>* next;
};

template <class t>
using nodePtr = Node<t>*;


@Repeater
Thank you for replying
I never used the keyword "using" except for using namespace std; May you please explain it to me briefly, in simple term?
Thank you again
Last edited on
I never used the keyword "using" except for using namespace std;

https://www.learncpp.com/cpp-tutorial/4-3c-using-statements/

C++11 added an additional use for using, as a type alias.
https://en.cppreference.com/w/cpp/language/type_alias

Similar to typedef.
https://en.cppreference.com/w/cpp/language/typedef

Having using namespace std; in your code is generally considered a bad practice.

https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
Topic archived. No new replies allowed.