Home > Back-end >  Rookie help reference types
Rookie help reference types

Time:09-21

Type

TMyClass=class;

TMyproc=procedure (Sender: TMyClass) of the object;


TMyClass=class (TComponent)//define the class TMyClass
Private
.
FMyproc: TMyproc;//
Protected
.
.
Procedure DoSum (aSum: TMyClass);//reference classes in the process of TMyClass

Public
The constructor Create (AOwner: TComponent); Override.//
The destructor Destroy; Override.

end;

Here in the class process refers to the class itself:
FMyproc: TMyproc;//
Procedure DoSum (aSum: TMyClass);//reference classes in the process of TMyClass


I do not understand, feel like recursion, please pass by friends help explain, it is better for small example

CodePudding user response:

Object-oriented, TMyClass this is a class,
TMyproc=procedure (Sender: TMyClass) of the object; Here determined is a process of type, TMyClass this type do you have this type of process parameters, and the actual runtime, parameters of the incoming is the entity, and recursive it doesn't matter, phase khan procedure DoSum (aSum: TMyClass); Process will be used in processing the data, the aSum entities in the data,
  • Related