在 Delphi 中 static 是可以修饰的, 只是稍做变化罢了.function Demo(AStr: String; IsGet: Boolean): String; const Static_Demo_String: String = 'This is Demo.'; begin if not IsGet then Static_Demo_String := AStr; result := Static_Demo_String; end;
// 这样更加合理 function Demo(IsGet: Boolean = True; AStr: String = ''): String; const Static_Demo_String: String = 'This is Demo.'; begin if not IsGet then Static_Demo_String := AStr; result := Static_Demo_String; end;
对了,还有stdcall不知道
Virtual-------虚拟方法
dynamic-------动态方法,和虚拟的区别是一个放在VMT中一个放在DMT中
override------覆盖,实现多态的方式,其中向下映射已经被Delphi禁止
overload------重载,解决方法同名的方式
reintroduce---重引入,舍弃从父类继承的重新定义
abstract------抽象,具体实现在子类中进行
safecall------调用约定的一种
const
Static_Demo_String: String = 'This is Demo.';
begin
if not IsGet then
Static_Demo_String := AStr;
result := Static_Demo_String;
end;
function Demo(IsGet: Boolean = True; AStr: String = ''): String;
const
Static_Demo_String: String = 'This is Demo.';
begin
if not IsGet then
Static_Demo_String := AStr;
result := Static_Demo_String;
end;
struct mystruct
{
int a:1;
int a:2;
int a:3;
int a:26;
}
还有一个联合结构union
不过PASIC中有一人absoulte,不过也不完全一样。
现在内存那么,有必要那么斤斤计较吗?
你想一下,
从Delphi1.0到2.0 integer都变成4个字节了..
不用这么节省内存了,还是看看怎么写程序快吧