nil
还有 Tgroupbox 什么类型呃
还有 Tgroupbox 什么类型呃
解决方案 »
- 虚心求教,求一个可通用的获取MAC地址的代码
- 请问delphi如何能导出MSoutlook的全球通讯薄smtp地址?
- 字符串'ABCD'用哪个函数可以转为'DCBA'?
- 使用FastReport设计报表遇到的一个问题,请帮忙解答一下!
- 如何确定一个控件的归属 除UP者外皆有分 答出问题开帖另加分
- 以下窗口事件是否可以用简化代码书写?
- 悬案------如果在98下注册这个.dll的话,打开的所有IE窗口在任务栏上的小窗口都消失了!!!
- 查找程序的子窗口,如何实现?
- ExtractFileDir和ExtractFilePath……
- 请问那位高手一个关于Excell的问题。
- 在没有安装SQL server 的机器上,怎么使用SQLDMO?(Up,也给分)
- 简单SQL语句:求一个与某字段最大值同条记录的另一个字段值。
如果你还不知道类和类型的区别,就看一点关于面向对象的书吧。
如果你有《设计模式》这本书,里面有非常精僻的解释--类和类型的区别
TGroupBox是一个类,同时又是一个可视控件。
如果发生是什么语句和ture fasle那样的
3 P: ^Integer; // P points to an Integer
4 begin
5 X := 17; // assign a value to X
6 P := @X; // assign the address of X to P
7 Y := P^; // dereference P; assign the result to Y
8 end;Line 2 declares X and Y as variables of type Integer. Line 3 declares P as a pointer to an Integer value; this means that P can point to the location of X or Y. Line 5 assigns a value to X, and line 6 assigns the address of X (denoted by @X) to P. Finally, line 7 retrieves the value at the location pointed to by P (denoted by ^P) and assigns it to Y. After this code executes, X and Y have the same value, namely 17.
The @ operator, which we have used here to take the address of a variable, also operates on functions and procedures. For more information, see The @ operator and Procedural types in statements and expressions.The symbol ^ has two purposes, both of which are illustrated in our example. When it appears before a type identifier?^typeName梚t denotes a type that represents pointers to variables of type typeName. When it appears after a pointer variable?pointer^梚t dereferences the pointer; that is, it returns the value stored at the memory address held by the pointer.
Our example may seem like a roundabout way of copying the value of one variable to another梥omething that we could have accomplished with a simple assignment statement. But pointers are useful for several reasons. First, understanding pointers will help you to understand Object Pascal, since pointers often operate behind the scenes in code where they don抰 appear explicitly. Any data type that requires large, dynamically allocated blocks of memory uses pointers. Long-string variables, for instance, are implicitly pointers, as are class variables. Moreover, some advanced programming techniques require the use of pointers.Finally, pointers are sometimes the only way to circumvent Object Pascal抯 strict data typing. By referencing a variable with an all-purpose Pointer, casting the Pointer to a more specific type, and then dereferencing it, you can treat the data stored by any variable as if it belonged to any type. For example, the following code assigns data stored in a real variable to an integer variable.type PInteger = ^Integer;
var
R: Single;
I: Integer;
P: Pointer;
PI: PInteger;
begin
...
P := @R;
PI := PInteger(P);
I := PI^;
end;Of course, reals and integers are stored in different formats. This assignment simply copies raw binary data from R to I, without converting it.
In addition to assigning the result of an @ operation, you can use several standard routines to give a value to a pointer. The New and
GetMem procedures assign a memory address to an existing pointer, while the Addr and Ptr functions return a pointer to a specified address or variable.
Dereferenced pointers can be qualified and can function as qualifiers, as in the expression P1^.Data^.The reserved word nil is a special constant that can be assigned to any pointer. When nil is assigned to a pointer, the pointer doesn抰 reference anything.