在VCL中文件流父类的定义 THandleStream = class(TStream)
protected
FHandle: Integer;
procedure SetSize(NewSize: Longint); override;
procedure SetSize(const NewSize: Int64); override;
public
constructor Create(AHandle: Integer);
function Read(var Buffer; Count: Longint): Longint; override;
function Write(const Buffer; Count: Longint): Longint; override;
function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;
property Handle: Integer read FHandle;
end;下面这个过程
function Read(var Buffer; Count: Longint): Longint; override;
中的Buffer是怎样理解的
protected
FHandle: Integer;
procedure SetSize(NewSize: Longint); override;
procedure SetSize(const NewSize: Int64); override;
public
constructor Create(AHandle: Integer);
function Read(var Buffer; Count: Longint): Longint; override;
function Write(const Buffer; Count: Longint): Longint; override;
function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;
property Handle: Integer read FHandle;
end;下面这个过程
function Read(var Buffer; Count: Longint): Longint; override;
中的Buffer是怎样理解的
解决方案 »
- fastreport中 绑定数据自动换行问题
- 做FTP的服务器,用何控件比较好???推荐就有分.
- Delphi 6.0到那里可以下载啊Delphi 6.0到那里可以下载啊Delphi 6.0到那里可以下载啊Delphi 6.0到那里可以下载啊Delphi 6.0到那里可以下载
- filter怎么用呀?
- 一个关于结构数组问题.如果解决不了的话只有用土办法了:)
- 查看Move函数的定义时发现一个奇怪的问题!!!
- 我想了解怎样操作软驱,如格式化3.5寸的各种格式等.各位大侠帮帮忙.
- 关于 windows api 复制函数问题
- Delphi如何调用淘宝接口?
- NT日志文件的文件格式?
- 怎么样知道一个文件夹下有没有文件被使用?
- 高分请教: delphi的小数问题。急,在线等待。。。
You can omit type specifications when declaring var, const, and out parameters. (Value parameters must be typed.) For example,procedure TakeAnything(const C);declares a procedure called TakeAnything that accepts a parameter of any type. When you call such a routine, you cannot pass it a numeral or untyped numeric constant.Within a procedure or function body, untyped parameters are incompatible with every type. To operate on an untyped parameter, you must cast it. In general, the compiler cannot verify that operations on untyped parameters are valid.The following example uses untyped parameters in a function called Equal that compares a specified number of bytes of any two variables.function Equal(var Source, Dest; Size: Integer): Boolean;
type
TBytes = array[0..MaxInt - 1] of Byte;
var
N: Integer;
begin
N := 0;
while (N < Size) and (TBytes(Dest)[N] = TBytes(Source)[N]) do
Inc(N);
Equal := N = Size;
end;Given the declarationstype
TVector = array[1..10] of Integer;
TPoint = record
X, Y: Integer;
end;
var
Vec1, Vec2: TVector;
N: Integer;
P: TPoint;you could make the following calls to Equal:Equal(Vec1, Vec2, SizeOf(TVector)) // compare Vec1 to Vec2
Equal(Vec1, Vec2, SizeOf(Integer) * N) // compare first N elements of Vec1 and Vec2
Equal(Vec1[1], Vec1[6], SizeOf(Integer) * 5) // compare first 5 to last 5 elements of Vec1
Equal(Vec1[1], P, 4) // compare Vec1[1] to P.X and Vec1[2] to P.Y
当声明var, const和out 形式的参数时,可以使用无型参数.所以的无型参数是指参数没有任何类型定义,比如:
procedure GetAnything(var Any);注意,Any没有任何类型声明,所以Any"可以为"任何类型:任何数据类型的实际参数都可以传给any.也正是没有任何类型声明,所以any "不为" 任何类型:在GetAnything过程体的内部,Any与任何类型都不兼容.在此要操作一个无型参数时,程序必须进行类型转换.
比如:
function IsEqual(var A,B): Boolean;
begin
IsEqual := Byte(A) = Byte(B);
end;