重载地址的运营商。我如何知道对象的地址

时间:2011-12-15 06:54:26

标签: c++ operator-overloading address-operator

  

可能重复:
  Overloading unary operator &

class A
{
public:
    A* operator&()
    {
        return NULL;
    }
};
int main()
{
    A obj;
    A* ptr=&obj;//ptr=NULL
    //determining obj's address here
}

可以确定这种类的对象的地址吗?

0 个答案:

没有答案