TMyItem = class(TCollectionItem)
constructor Create(Collection : TMyCollection)
begin
inherited Create(TCollection(Collection))
end
or same thing with abstract error
constructor Create(Collection : TCollection)
begin
inherited Create(Collection)
end
TMyCollection = class(TCollection)
FManager : TManager
function Add: TMyItem;
begin
Result := TMyItem(inherited Add);
end;
function GetOwner : TPersistent; override;
begin
Result := TPersistent(FManager);
end;
constructor Create(Manager : TManager)
begin
inherited Create(TMyItem);
FManager := Manager;
end;
TManager = class TObject
FMyCollection : TMyCollection;
property MyCollection : TMyCollection read FMyCollection write
FMyCollection;
procedure AfterConstruction;
begin
FMyCollection.Create(Self);
end;
var
GlobalManager : TManager;
procedure ButtonClick(Sender : TObject);
var
aItem : TMyItem;
begin
aItem := GlobalManager.MyCollection.Add // ABSTRACT ERROR
HERE!!!
end;
The best part: I have second project with similar (equal, identical)
code, but with different classes names and different type of program
(drawing) and Delphi compile this project without problem.
Please help me