help上说此类型与这个type的祖先类是assignment-compatible
解决方案 »
- DELPHI中CHART的标题在哪里修改?
- adotable删除
- 将日期写不到数据库,是怎么回事呀。详情如下。
- idhttp的问题,寻知情人解决
- 求DELPHI通过GDI+实现"通过位图创建多边形区域"(300分)
- DELPHI调用VB执行文件 CREATEPROCESS 报 87 的错误! SOS !
- 在richedit中只能撤销一次操作,我要撤销n次操作应该如何实现,高分献上。
- 请教一个关于调用VC创建的DLL的问题
- 谁有收邮件的第三方控件,急用!!!
- 何处下载IIS Resourse Kit?
- 怎样显示gif图片
- 请问在没装office的情况下,如何用ADO连接Access数据库(不用ODBC)
比如:
TFormClass = class of TForm;var
a: TFormClass;
b: TForm;
...
a := TForm1;
b := a.Create(nil);
type TCollectionItemClass = class of TCollectionItem; ...
constructor Create(ItemClass: TCollectionItemClass);这里的Create要求你填入的值应当为类的名字,而不是一个具体的对象值
比如可以为:
Create(TCollectionItem)
但是不可以为:
var
Item: TCollectionItem;
begin
...
Create(Item);
这也就是前面的定义与
constructor Create(Item: TCollectionItem);
的本质区别。
function CreateControl(ControlClass: TControlClass; const ControlName: string; X, Y, W, H: Integer): TControl;
begin
Result := ControlClass.Create(MainForm);
with Result do
begin
Parent := MainForm;
Name := ControlName;
SetBounds(X, Y, W, H);
Visible := True;
end;
end;The CreateControl function requires a class-reference parameter to tell it what kind of control to create. It uses this parameter to call the class抯 constructor. Because class-type identifiers denote class-reference values, a call to CreateControl can specify the identifier of the class to create an instance of. For example,CreateControl(TEdit, 'Edit1', 10, 10, 100, 20);Constructors called using class references are usually virtual. The constructor implementation activated by the call depends on the runtime type of the class reference.