title: Destructor causes Segmentation Fault
body: <p>I know there's a lot of similar questions out there, but I haven't found anything that helps yet. I've been at this for several hours now and it's driving me crazy. I get a segmentation fault when a destructor is called for a variable that was created by the copy constructor.</p>
  
  <pre><code>//Copy Constructor
  Stack::Stack(const Stack &amp;aStack)
  {
     size = 0; //this is incremented as new items are pushed onto the stack.
     cap= aStack.cap;
     items = new int[aStack.cap]();
     for (int i = 0; i &lt; aStack.size; i++)
        this-&gt;push(aStack.items[i]);  //Adds an item if not full and increments size
        // I have also tried: items[i] = aStack.items[i]
  }
  
  //Destructor
  Stack::~Stack()
  {
     cap= 0;
     size= 0;
     delete [] items;
     items = NULL;
  }
  </code></pre>
  
  <p>I get the feeling I'm doing the copy constructor wrong, but I can't figure out what it is.</p>