I have this project in my Data Structures course to create a dynamic stack (otherwise I would use STL in all other cases). I'm implementing the resize feature by making use of the assignment operator and copy constructor, multiplying the capacity by two.
I believe I have implemented the copy constructor and assignment operator properly, using the copy and swap idiom here,
PS: the int i = 0 in several of the functions are there just so I can have something to put a break point on and see the result of the previous line in the debugger. Just ignore them.
The semantics of your operator= look wrong to me. I would expect stack1 == stack2 after using the assignment operator. Not for stack2 to swap contents with stack1.
std::auto_ptr<>::operator= does swap, or move, rather than copy. But most people would steer clear of it these days and use boost::shared_ptr, which supports copy semantics.
Well it's making a copy of stack2 and then assigning it to stack one. That link in my post proved really useful as a guide on this, but I'm not some of the stuff I'm not exactly sure about.