-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClasePila.h
More file actions
35 lines (27 loc) · 972 Bytes
/
ClasePila.h
File metadata and controls
35 lines (27 loc) · 972 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
// Archivo encabezado para la definicion de una clase para un TDA Pila
// Realizacion dinamica mediante una clase y apuntadores
#include "exepcionesclase.h"
typedef int StackItemType;
class Stack{
public:
//Constructores y Destructor:
Stack();//Constructor por default
Stack(const Stack& aStack);//Constructor Copia
~Stack(); //Destructor
// Funciones/Operaciones de Pila
bool isEmpty() const;
void push(StackItemType newItem); // throw(StackException);
void pop();// throw(StackException);
void pop(StackItemType& stackTop);// throw(StackException);
void getTop(StackItemType& stackTop) const;// throw(StackException);
void print();
int mainPila();
private:
struct StackNode // Un nodo en la pila
{
StackItemType item; // Almacenamiento para una entero
StackNode *next; // apuntador hacia otro nodo
}; //Fin struct
StackNode *topPtr; //Apuntador al inicio de la Pila
}; //Fin de la Clase Stack
//Fin Del archivo de Encabezado