Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hey there I have this doubly linked class, I need help with this copy constructo

ID: 3925307 • Letter: H

Question

 Hey there I have this doubly linked class, I need help with this copy constructor.   
 Here is the Node class:    
 class Node { private:     T data;     Node<T> *prev;     Node<T> *next; 
 public:   
 template<class T> Node<T> *Node<T>::getPrev() const { return prev; }  template<class T> Node<T> *Node<T>::getNext() const { return next; } 
  --------------------------------- Here is the header file:    
 template<class T> class DLinkedStack : public StackInterface<T> { 
 private:     Node<T> *headPtr;    // Pointer to first node in the chain;     Node<T> *topPtr;     // to the end  
 template<class T> DLinkedStack<T>::DLinkedStack(const DLinkedStack<T> &aStack) {     //TODO - Implement the copy constructor  } 

Explanation / Answer

Here you need to assign memory individually otherwise pointer will point to same momory location.

============================

Thanks