-
Notifications
You must be signed in to change notification settings - Fork 3
/
Nodo.h
62 lines (44 loc) · 1.11 KB
/
Nodo.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
62
#ifndef NODO_H_
#define NODO_H_
#ifndef NULL
#define NULL 0
#endif
template<class T> class Nodo {
private:
T dato;
Nodo<T>* siguiente;
public:
/*
* post: el Nodo resulta inicializado con el dato dado
* y sin un Nodo siguiente.
*/
Nodo(T dato) {
this->dato = dato;
this->siguiente = NULL;
}
/*
* post: devuelve el valor del dato.
*/
T obtenerDato() {
return this->dato;
}
/*
* post: cambia el valor del dato.
*/
void cambiarDato(T nuevoDato) {
this->dato = nuevoDato;
}
/*
* post: devuelve el siguiente Nodo.
*/
Nodo<T>* obtenerSiguiente() {
return this->siguiente;
}
/*
* post: cambia el siguiente Nodo por nuevoSiguiente.
*/
void cambiarSiguiente(Nodo<T>* nuevoSiguiente) {
this->siguiente = nuevoSiguiente;
}
};
#endif /* NODO_H_ */