of object
这个在过程后,有什么意义!我不太明白

解决方案 »

  1.   

    这里面怎么多高手,为什么不能帮助一下啊!
    type
        proc = wndproc(value:integer) of object
    of object 这个有什么意义!
    我不明白啊
      

  2.   

    表明是什么类!在这里表明自定义类型proc为一个object类
      

  3.   

    If you want to reference a method of an instance object (see Classes and objects), you need to add the words of object to the procedural type name. For exampletype  TMethod = procedure of object;
      TNotifyEvent = procedure(Sender: TObject) of object;These types represent method pointers. A method pointer is really a pair of pointers; the first stores the address of a method, and the second stores a reference to the object the method belongs to. Given the declarationstype  TNotifyEvent = procedure(Sender: TObject) of object;
      TMainForm = class(TForm)
        procedure ButtonClick(Sender: TObject);
        ...
      end;
    var
      MainForm: TMainForm;
      OnClick: TNotifyEventwe could make the following assignment.OnClick := MainForm.ButtonClick;Two procedural types are compatible if they havethe same calling convention,
    the same return value (or no return value), and
    the same number of parameters, with identically typed parameters in corresponding positions. (Parameter names do not matter.)Procedure pointer types are always incompatible with method pointer types. The value nil can be assigned to any procedural type.
    Nested procedures and functions (routines declared within other routines) cannot be used as procedural values, nor can predefined procedures and functions. If you want to use a predefined routine like Length as a procedural value, write a wrapper for it:function FLength(S: string): Integer;begin
      Result := Length(S);
    end;
      

  4.   

    用来定义事件过程的类型
    如果你开发自己的控件中,事件的参数需要自己定义,那么定义时就要加上of object,如TMyNodify = procedure (Sender: TObject; ARef1: Integer; ARef2: TControl) of object;type
      MyComponent = class(TComponent)
        ...
      private
        ...
        FMyEvent: TMyNodify;
        ...
      published
        ...
        property OnMyEvent: TMyNodify read FMyEvent write FMyEvent;
        ...
      end;
      

  5.   

    表明是什么类!在这里表明自定义类型proc为一个object类的过程!!!!!!!!!!!!
      

  6.   

    方法指针,是函数指针的一种.引用一个对象的方法而不是独立的函数的时候,必须用of object的函数指针.
    对象的方法和独立函数的区别在于一个隐含参数,好像是,类的方法有个隐含的参数,传递主调此方法的对象.比如 AnObject.AMethod(AParam) ,编译时是按 AMethod(AnObject,AParam) 处理的.而独立方法没有这个隐含参数,归根到底还是函数指针和其引用的函数参数一致的问题.
      

  7.   

    procedure .... of object 是方法指针
    来看方法的定义
      TMethod = record
        Code, Data: Pointer;
      end;
    它包含Code:代码指针,Data:数据指针,其实Code指向函数体本身,Data指向所属的类这样不同的类可以调用统一个方法,但Data指向的类不同,Code执行效果也不同-对不同的
    类操作,例如“事件”Event就是这样做的