Hello can we call the copy constructor inside the class ie?Ican't seem to figure out how to do this.

Any help would be greatly appreciated

#include
#include “Stack.h”

using namespace std;

//*******************************
//** Copy constructor
//*******************************
Stack::Stack( const Stack&stack)
{

Node *copy = new Node;
Node *newNode = new Node;
Node *actual = new Node;;

copy = top;
actual = stack.top;

if(actual != NULL)
{
newNode -> data = actual->data;
top = newNode;
newNode ->next = NULL;
actual = actual ->next;
cSize++;

while(actual != NULL)
{coutdata
Node *temp = new Node;
temp->data = actual ->data;
temp->next = top;
top = temp;
cSize++;
actual = actual->next;
}
}
}

//*******************************
//* Assigment overloaded
//*******************************
const Stackoperator= (const Stack &rhs)
{
//Stack(rhs);

}

 

Doing a similar assignment? Save your time and hire our Genuine Essay Writers to do your task. Get 15% Discount on your 1st order. Use code: FREE15