delphi父类的属性数据存储声明在pvivate中,而子类又只能继承属性本身,不能继承父类private部分,那么子类的属性值将被存储在那里?例如以下的一个类:
type
TFather=class(Tcompnoent)
private
Fcount:integer; //数据存储声明
public
property Count:integer read FCount write Fcount;
End;以下的类继承了Tmycomponent:
Type
TSon=class(TFather)
...
End;
这时,Tson继承了 属性Count而没能继承Fcount,那么以后Tson的Count将在那里存储属性值?另外,如果TFather 的属性值采用函数来读写,而读写函数又声明在private中声明:
type
TFather=class(Tcomponent)
private
FCount:integer;//数据存储声明
Function GetCount:integer;//属性Count的读方法
procedure SetCount:(const value:integer);//属性Count的写方法
published
property Count:integer read GetCount Write SetCount;
End;
此时,Tson只继承了 property Count,那么以后Tson将用什么方法对Count进行读写?另外一个问题:
在一些记录类型的声明中,packed 是什么意思?例如 :
type
TA= packed Record
...
end;
以上问题,请大家给我说说,我确找不到资料。或者我还没理清概念,根本上问错了问题。但不管怎样,请不要笑我。
type
TFather=class(Tcompnoent)
private
Fcount:integer; //数据存储声明
public
property Count:integer read FCount write Fcount;
End;以下的类继承了Tmycomponent:
Type
TSon=class(TFather)
...
End;
这时,Tson继承了 属性Count而没能继承Fcount,那么以后Tson的Count将在那里存储属性值?另外,如果TFather 的属性值采用函数来读写,而读写函数又声明在private中声明:
type
TFather=class(Tcomponent)
private
FCount:integer;//数据存储声明
Function GetCount:integer;//属性Count的读方法
procedure SetCount:(const value:integer);//属性Count的写方法
published
property Count:integer read GetCount Write SetCount;
End;
此时,Tson只继承了 property Count,那么以后Tson将用什么方法对Count进行读写?另外一个问题:
在一些记录类型的声明中,packed 是什么意思?例如 :
type
TA= packed Record
...
end;
以上问题,请大家给我说说,我确找不到资料。或者我还没理清概念,根本上问错了问题。但不管怎样,请不要笑我。
你访问不到罢了.问题二:PACKED是指按紧凑格式分配内存空间.
像有些机器上要内存偶字节对齐格式,就是说内存变量只能从偶字节开始分配.
那么你的记录的实际用的内存的大小可能就和你比你的记录的大小大一些.
如果写入文件中,就可能有些问题 .