#include <iomanip>
#include <iostream>
using namespace std;
template< class T >
class cPtr{
T * ptr;
public:
cPtr(T *p = 0){
ptr = p;
}
T * operator()(void) const{
return ptr;
}
~cPtr(){
delete ptr;
}
};
int main(){
int * val1 = new int[1];
int * val2 = new int[1];
(*val1) = 256;
(*val2) = 128;
cPtr< int > p1(val1);
cPtr< int > p2(val2);
cout<<hex<<p1()<<endl;
cout<<hex<<p2()<<endl;
p1 = p2;
p2 = p1;
cout<<hex<<p1()<<endl;
cout<<hex<<p2()<<endl;
return 0;
}