Hi there,
I have a class which has standard members (i.e. string / integer fields). But there's a private variable of type TObjectList and the most beautiful thing of that member is that it is a list of object of itself... recursivity...
Also, there's another private variable object which I need to share between all instance stored in the TObjectList.
Here's some code to illustrate my point:
----------------------------------------------------------
type
TlstBase = class;
TclsBase = class
private
{ Private declarations }
sID : String;
sDesc : String;
iLevel : Integer;
-> oShare : TclsShare;
lstChild : TlstBase;
public
{ Public declarations }
property ID: string read sID write sID;
property Desc: string read sDesc write sDesc;
property Level: integer read iLevel write iLevel;
-> property Items: TlstBase read lstChild write SetItems;
end;
TlstBase = class(TObjectList)
private
function GetItem(Index: Integer): TclsBase;
procedure SetItem(Index: Integer; AObject: TclsBase);
public
function Add(AObject: TclsBase): Integer;
property Items[Index: Integer]: TclsBase read GetItem write SetItem; default;
end;
---------------------------------------------------------
So, the private member I need to share between Items is oShare. Is there a magic keyword that will do so???
Thanks a lot for reading,
Rej Cloutier
I have a class which has standard members (i.e. string / integer fields). But there's a private variable of type TObjectList and the most beautiful thing of that member is that it is a list of object of itself... recursivity...
Also, there's another private variable object which I need to share between all instance stored in the TObjectList.
Here's some code to illustrate my point:
----------------------------------------------------------
type
TlstBase = class;
TclsBase = class
private
{ Private declarations }
sID : String;
sDesc : String;
iLevel : Integer;
-> oShare : TclsShare;
lstChild : TlstBase;
public
{ Public declarations }
property ID: string read sID write sID;
property Desc: string read sDesc write sDesc;
property Level: integer read iLevel write iLevel;
-> property Items: TlstBase read lstChild write SetItems;
end;
TlstBase = class(TObjectList)
private
function GetItem(Index: Integer): TclsBase;
procedure SetItem(Index: Integer; AObject: TclsBase);
public
function Add(AObject: TclsBase): Integer;
property Items[Index: Integer]: TclsBase read GetItem write SetItem; default;
end;
---------------------------------------------------------
So, the private member I need to share between Items is oShare. Is there a magic keyword that will do so???
Thanks a lot for reading,
Rej Cloutier