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

You might also like to view...

Once a workbook is ________ it is read-only

Fill in the blank(s) with correct word

Computer Science & Information Technology

The layer of the OSI model known as Layer 3 is the transport layer

Indicate whether the statement is true or false

Computer Science & Information Technology