-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemlistnode.h
66 lines (53 loc) · 1.23 KB
/
temlistnode.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// this file presents a definition to the template clss Listnode
#ifndef TEMLISTNODE_H
#define TEMLISTNODE_H
#include <iostream>
template <class Nodetype> class List;
template < class Nodetype>
class Listnode {
friend class List<Nodetype>;
public:
Listnode( Nodetype , Listnode <Nodetype> *);
~Listnode();
Listnode <Nodetype> *getnext (){return nextptr;};
void set_sup (int sp){support = sp;};
void set_comblnth (int cm){combl = cm;};
int com(){return combl;};
int sup() {return support;};
int comblnth() {return combl;};
void set_next(Listnode *next){nextptr = next;};
void set_data(Nodetype value){data = value;};
Nodetype getdata() {return data;};
void clear();
private:
Nodetype data;
Listnode <Nodetype> *nextptr;
int support;
int combl;
};
// constructor
template <class Nodetype>
Listnode <Nodetype>::Listnode(Nodetype info, Listnode<Nodetype> *next)
{
data = info;
nextptr = next;
support=0;
combl=0;
}
//destructor
template <class Nodetype>
Listnode <Nodetype>::~Listnode()
{
nextptr = NULL;
data = 0;
support = 0;
combl = 0;
}
template <class Nodetype>
void Listnode<Nodetype>::clear(){
nextptr = NULL;
data = 0;
support = 0;
combl = 0;
}
#endif