Question: Modify the IntStack class of Section 18.2 by adding a copy constructor and a copy assignment operator. Test your code ina program that creates a

Modify the IntStack class of Section 18.2 by adding a copy constructor and a copy assignment operator. Test your code ina program that creates a stack, pushes some values onto it, and then copies the stack two different ways, one using a copy constructor and one using copy assignment. Your program should include code that demonstrates the correctness of the new operations.

please help me! Thank you so much in advace!

IntStack class of section 18.2:

class DynIntStack

{

struct StackNode

{

Int value;

StackNode *next1;

// Constructor

StackNode (int value1,StackNode *next1 = nullptr)

{

value = value 1;

next=next1;

}

};

StackNode *top;

public:

DynIntStack() { top = nullptr; }

~DynIntStack();

void push (int);

void pop (int &);

bool isEmpty() const;

//Stack Exception

Class Underflow{};

};

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!