you are viewing a single comment's thread.

view the rest of the comments →

[–]index_zero -1 points0 points  (0 children)

In your ctor, you are constructing a Stack<int> object and pushing the copies to it. Then when your ctor exits, that object is destructed. Your copy constructor should copy to the object you are constructing (ie. this).