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 *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.
Function | Parameter(s) | Return value |
---|---|---|
Destructor | None | None |
delete stack;
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.
mystack -> push(4);
Function | Parameter(s) | Return value |
---|---|---|
Adds an integer value onto stack | value to put into new node | None |
tmp = mystack -> pop();
Function | Parameter(s) | Return value |
---|---|---|
Removes top node from stack | None | Returns pointer to node just removed |
tmp = mystack -> peek();
Function | Parameter(s) | Return value |
---|---|---|
Returns value of top Node | None | Location of top node on stack |
length = mystack -> getLength();
Function | Parameter(s) | Return value |
---|---|---|
Gets length of stack | None | Int value of length |
status = mystack -> setLength(4);
Function | Parameter(s) | Return value |
---|---|---|
Sets length of stack | int length to set stack | Returns success vs failure |