Given the following stack declaration, which of the following function definitions would correctly implement the destructor?
struct StackFrame
{
char data;
StackFrame *link;
};
typedef StackFrame* StackFramePtr;
class Stack
{
public:
Stack( );
Stack(const Stack& a_stack);
~Stack( );
void push(char the_symbol);
char pop( );
bool empty( ) const;
private:
StackFramePtr top;
};
a. top=NULL;
b.
char next;
while (! empty( ))
next = pop( );//pop calls delete.
c.
char next;
while(!empty( ))
next = push();
d. none of the above
b.
char next;
while (! empty( ))
next = pop( );//pop calls delete.
Computer Science & Information Technology