Hi,
Although I've been doing some stuff with Delphi, I thin kthis is the first time I'm defining a subclass directly from TObject. Well, I have the following:
type
TTrack = class(TObject)
public
Name: AnsiString;
Loops: TObjectList;
FXs: TObjectList;
constructor Create(inName: AnsiString); overload;
destructor Destroy; override;
private
end;
....
implementation
constructor TTrack.Create(inName: AnsiString);
begin
inherited Create;
Name := inName;
Loops := TObjectList.Create;
FXs := TObjectList.Create;
end;
When I create an object of this class, when I try to assign a property in the constructor, like "Name := inName;" above, I get an EAccessViolation exception. I've gone through the help, looked at some tutorial and other source code and I can't see what the problem is. It is supposed that TObject.create allocates memory, and I am calling it at the begining. What is it that I am doing wrong?
Thanks,
Ashkar
Although I've been doing some stuff with Delphi, I thin kthis is the first time I'm defining a subclass directly from TObject. Well, I have the following:
type
TTrack = class(TObject)
public
Name: AnsiString;
Loops: TObjectList;
FXs: TObjectList;
constructor Create(inName: AnsiString); overload;
destructor Destroy; override;
private
end;
....
implementation
constructor TTrack.Create(inName: AnsiString);
begin
inherited Create;
Name := inName;
Loops := TObjectList.Create;
FXs := TObjectList.Create;
end;
When I create an object of this class, when I try to assign a property in the constructor, like "Name := inName;" above, I get an EAccessViolation exception. I've gone through the help, looked at some tutorial and other source code and I can't see what the problem is. It is supposed that TObject.create allocates memory, and I am calling it at the begining. What is it that I am doing wrong?
Thanks,
Ashkar