在线程中创建自定义类的实例时报 abstract error VCL组件开发及应用http://www.delphi2007.net/DelphiVCL/html/delphi_20061225124650126.html
Tobj = class(Tobject)
private
fname:string;
procedure setname;
public
property name read fname write setname ;
end;
tthreadprocess = class(tthread)
private
obj:tobj;
protected
procedure execute ;
end;
procedure tthreadprocess.execute;
begin
obj := Tobj.create //这句报错 "abstract error "
end;
why??
tthreadprocess = class(tthread)
private
obj:tobj;
protected
procedure execute ;override;
end;
procedure Execute; virtual; abstract;
这是个抽象的方法,要重载。
execute 过程是 override 的,打上去的的时候漏掉的
Tobj = class(Tobject)
private
fname:string;
procedure setname;
public
property name read fname write setname ;
end;
--------------------------------------------
TObj = class
private
FName: string;
procedure SetName(const Value: string); //这里确认是否是这样写
public
property Name: string read FName write SetName //你少了:String
end;