Read what the God Of C++ (Stroustrup) had to say:
regards,Code:int main() { X ob; X *prt = &ob;No. You get the address from "this"; that doesn't involve a call of operator&(). The operator&() you define affects only explicit uses of &. Also, you be careful about making assumptions about what the compiler does. No global function called operator&() will be generated here. If it didn't you might get some "interesting" overload problems. // I would like to understand how does it work ??? or rather why it works return 0; }// implies ==> X* ptr = ob.X::operator&() // which implies ==> X* prt = X::operator&(&ob); // My question is since the call to operator& member function must pass the // address of the calling object, logically shouldn't this result in a recursive call.
Shiv