user_
asked on
Tstrings , Abstract Error ?
the following code raise the runtime error (abstract error )
whats the problem ?
var Txt:Tstrings;
begin
Txt:=Tstrings.create;
Txt.add('some text'); // Error raised here
Txt.free
end;
whats the problem ?
var Txt:Tstrings;
begin
Txt:=Tstrings.create;
Txt.add('some text'); // Error raised here
Txt.free
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i used TStringList before but i want to know what cause the error
thankx Fernando
thankx Fernando
in unit classes.pas you can see the TString's source code.
function TStrings.Add(const S: string): Integer;
begin
Result := GetCount;
Insert(Result, S);
end;
but TString's Insert method is abstract, and this raise the runtime error. As I said before, use TStringList or derive TStrings yourself : )
Regards,
Fernando - Brasil