i trying to undestand how overload operator work , i did a test to overload a ptr = ptr operator but it didn t work really well. i try to do it with referent and it work but why ptr don' work ? it is because we can t overload this operator ?
Thanks in advance to everyone.
#include<iostream> 
using namespace std; 
class Test 
{ 
    int *ptr; 
public: 
    Test (int i = 0)      { ptr = new int(i); } 
    void setValue (int i) { *ptr = i; } 
    void print()          { cout << *ptr << endl; } 
    Test * operator = (Test *t); 
}; 
Test *Test::operator = (Test *t) 
{ 
   // Check for self assignment 
   std::cout << "here\n";
   return this; 
} 
int main() 
{ 
    Test *t1 = new Test(5); 
    Test *t2 = new Test(6);
    t2->print(); 
    t2 = t1; 
    t1->setValue(10); 
    t2->print(); 
    return 0; 
} 
 
     
    