Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TCollection Abstract Error

13 views
Skip to first unread message

Vlada61

unread,
May 30, 2008, 4:32:11 PM5/30/08
to
Here is code:

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

0 new messages