-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnode.h
More file actions
42 lines (27 loc) · 767 Bytes
/
node.h
File metadata and controls
42 lines (27 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef NODE
#define NODE
#include <iostream>
using namespace std;
template <class T>
struct Node{
T item;
Node* next;
Node* previous;
//Constructor
//================================
//Initialize item with _item
Node(T _item):item(_item),next(NULL),previous(NULL){}
//Default Constructor
//=================================
Node():item(T()),next(NULL),previous(NULL){}
template <class U>
friend ostream& operator<<(ostream& outs,const Node<U> RHS);
//Precondition: RHS node can be any type
//Postcondition: return the node
};
template <class U>
ostream& operator<<(ostream& outs,const Node<U> RHS){
outs<<RHS.item;
return outs;
}
#endif // NODE