如何判断两个对象指针(n1,n2)所指的对象是同一个?

解决方案 »

  1.   

    procedure TForm1.Button4Click(Sender: TObject);
    var
      A, B, C: TButton;
    begin
      A := TButton.Create(Self);
      B := A;
      if A = B then
        ShowMessage('=')
      else
        ShowMessage('<>');
      A.Free;
      B := nil;
      A := nil;
    end;
      

  2.   

    procedure TForm1.Button4Click(Sender: TObject);
    var
      A, B, C: TButton;
    begin
      A := TButton.Create(Self);
      B := A;
      if A = B then
        ShowMessage('=')
      else
        ShowMessage('<>');
      A.Free;
      B := nil;
      A := nil;
    end;
      

  3.   

    好象不是吧。  A := TButton.Create(Self);
      B := A;
      此时,应该是A,B同时指向原A的对象。我想问的是,给我:A,B两个指针(假设已经知道他们都针对对象),我想判断:A,B背后的对象是否是同一个。如何操作?
      

  4.   

    if @A = @B then 
      ...
    else
      ...是这意思?
      

  5.   

    我也不董阿   if @A = @B 中的@什么意思,还有handle究竟什么意思!xie xie
      

  6.   

    @是C中的运算符。handle是句柄。
      

  7.   

    @是C中的运算符,是什么意思啊,在delphi中为什么要引用C中的运算符阿!handle试句柄,我知道但不知道具体干么用,起到一个什么作用?谢谢
      

  8.   

    handle具体干什么用啊,说的通俗点