Implementing a stack ADT with templates: Part A
A simple stack ADT implementation's header file is
stackclass.h (which uses
boolean.h).
Make this version generic by using a template class.
Make sure that the class works with
TestStack.cpp,
which should produce the output:
About to push A, B, C
Pop of and echo until empty
C B A
Note: See the information about
compiling
with templates before trying to compile your program.
Answer
Implementing a SmackStack ADT: Part B
Implement the ADT smackstack, using inheritance from the stack implementation.
A smackstack is like a stack, but includes a funky new Smack
operation, which removes the bottom element if it exists.
Make sure that the class works with
TestSmackStack.cpp,
which should produce the output:
About to push A, B, C
Smack out the A
Smacked out A
Pop of and echo until empty
C B
Note: See the information about
inheritance.
Answer