delphi参数传递(Delphi参数传递)
Delphi parameter passing
Parameter passing
The arguments used to declare / implement a procedu (I); (I =1}
Showmessage (I): (i:=1; the argument has not changed}
ByRef (I); {I =2)
Showmessage (I): (i:=2, the argument changed}
End;
A parameter passed by value can specify a default value, such as the ByVai above:
Procedure ByVai (I: Integer = 0):
When you call it, you can omit arguments that have default values: ByVai. Parameters with default values must be at the end of the parameter list, such as:
Procedure ByVai (I:, Integer = 0, B:, Boolean):
No, it should be changed to..:
Procedure ByVai (B: Boolean; I: Integer = 0):
Because the default value must be a constant expression, so dynamic-array procedural, class, class-reference, and interface nil can be specified by default: and the parameters of record, variant, file and static-array type can not specify a default value.
If you pass arguments to a pointer type by value, the situation becomes complicated and interesting. At this point, what is the actual transmission? Is it a copy of the actual data? No, it's a copy of the pointer. That is, the parameter and argument are two pointers, but the two pointers point to the same address. So at this point, the parameters and arguments can be shared and they point to the data in the address, but if the pointer to the parameter is changed, the pointer
delphi参数传递(Delphi参数传递) 来自淘豆网m.daumloan.com转载请标明出处.