Q:

How can I use a destructor in C++ when an object can be changed in another object

The situation is like this. 
class Class1{
public:
    Class1(int N){
        p = new int [N];
     }
    ~Class1(){
        delete []p;

    }
...
private:
    int *p;
};

class Class2(){
public:
    Class2(){
        int N = somthing;
        A = Class1(N);
          ...
    }
    ...
private:
    Class1 A;
}

Basically, Class2 is a complex object that uses Class1 as part of it and will change it. 
The problem is that if I do this way, the destructor for Class1 will cause error.  
Is there any other solutions to this kinds of problem in C++? 

A:

One obvious problem is that you have a class that manages a resource, Class1, but it is not safely copyable and assignable.  Any copy or assignment will result in more than one instance attempting to delete the same array, since all instances will have pointers pointing to one single array.  If your class is intended to own the resource, you need to provide a copy constructor and an assignment operator.  This is commonly known as the rule of three.