User Tools

Site Tools


notes:data:stack

stack class

Stack()

Stack *mystack = new Stack;
Function Parameter(s) Return value
Stack() none pointer to the newly allocated stack

Stack() is the parameterless constructor that is responsible for creating a new instance of a stack.

Stack(int)

Stack *mystack = new Stack(4);
Function Parameter(s) Return value
Stack() int to be assigned to the maximum stack length pointer to the newly allocated stack

Stack(int) is the overloaded constructor that is responsible for creating a new instance of a stack.

~Stack()

Function Parameter(s) Return value
Destructor None None
delete stack;

void push(LNode *)

mystack -> push(tmp);
Function Parameter(s) Return value
push(LNode *) LNode * to be added to top of stack void

push(LNode *) is a method to add a LNode * to top of stack.

void push(int)

mystack -> push(4);
Function Parameter(s) Return value
Adds an integer value onto stack value to put into new node None

LNode *pop()

tmp = mystack -> pop();
Function Parameter(s) Return value
Removes top node from stack None Returns pointer to node just removed

LNode *peek()

tmp = mystack -> peek();
Function Parameter(s) Return value
Returns value of top Node None Location of top node on stack

int getLength()

length = mystack -> getLength();
Function Parameter(s) Return value
Gets length of stack None Int value of length

bool setLength(int)

status = mystack -> setLength(4);
Function Parameter(s) Return value
Sets length of stack int length to set stack Returns success vs failure

notes/data/stack.txt · Last modified: 2010/11/17 21:36 by bwilson3