Copy Constructor for pointers to objects
问题 I am having problem in writing copy constructor for pointers to objects. This is my exact problem I have a class G1 that has an object s1 as its private data member. This is an object of a struct. The struct is composed of a vector<pair<int,pointer to another object of a different class>>. Now when I create a pointer for G1 everything is fine. When I try to copy this pointer to another new pointer of the same class it is making a shallow copy. So when I try to delete the first pointer the