我想继承TStringList,该怎么写?这是我的代码:
type
MetricsList = class(TStringList)
private public
constructor create(Owner: TStringList);
destructor Destroy; override;
end;implementation{ MetricsList }constructor MetricsList.create(Owner: TStringList);
beginend;destructor MetricsList.Destroy;
begin inherited;
end;我想初始化一个有内容的列表,比如
add('a');
add('b');
add('c');就是不知该如何写?我知道C和python的怎么写,delphi的不太了解
type
MetricsList = class(TStringList)
private public
constructor create(Owner: TStringList);
destructor Destroy; override;
end;implementation{ MetricsList }constructor MetricsList.create(Owner: TStringList);
beginend;destructor MetricsList.Destroy;
begin inherited;
end;我想初始化一个有内容的列表,比如
add('a');
add('b');
add('c');就是不知该如何写?我知道C和python的怎么写,delphi的不太了解
解决方案 »
- 这两天CSDN的访问速度很慢
- Delphi + 汇编
- delphi中帮助文件是如何创建的呀,请教
- 如何使用Delphi6 开发dll for asp 时返回数据用于赋值给asp的变量
- (我保证问题解决分数再加200)老问题再次出现!问题没有揭贴永远有效。我会一直关注,直到问题解决,谢谢!
- 菜鸟不明白的小问题
- 终于升星了!爽啊,感谢csdn的兄弟姐妹门,今天散分,大家一起爽,UP有分!
- 我在Dephi4书上发现有GetTimeString函数,但是我在Dephi6中用的时候没有这个函数。
- 这样写网络收发包的线程程序是否会使线程阻塞?
- 下面的贴子怎么不能打开了???
- Devexpress for delphi7 成功安装全过程
- delphi2007 汉语注释显示不全的问题
初始列表可以在创建的时候手动写代码添加嘛...
type
MetricsList = class(TStringList)
private public
constructor create(Owner: TStringList);
end;implementation{ MetricsList }constructor MetricsList.create(Owner: TStringList);
begin
Add('a');
Add('b');
Add('c');
end;
直接用TStringList就够了,而且把Item写死了也不是很好吧
constructor create(Owner: TStringList; const a,b,c:String);constructor MetricsList.create(Owner: TStringList; const a,b,c:String);
begin
Add(a);
Add(b);
Add(c);
end;
MetricsList = class(TStringList)
private public
constructor create(Owner: TStringList);
destructor Destroy; override;
end;implementation{ MetricsList }constructor MetricsList.create(Owner: TStringList);
begin
inherited Create;
Add('a');
Add('b');
Add('c');
end;destructor MetricsList.Destroy;
begin inherited;
end;
inheritd Greate;
MetricsList = class(TStringList)
private public
constructor create(Owner: TStringList);
end;implementation{ MetricsList }constructor MetricsList.create(Owner: TStringList);
begin
inherited Created(Owner);
Add('A');
Add('B');
Add('C');
end;