getting an object pointed by an item within a Tlist in delphi6
Posted on 2003-03-06
It is easy to create bug with pointer so I would like to check the following (I know Tobjectlist is more handy but I try to findout a bug in a code written with TLIST) :
Assume I have a class
TmyObject = class(TObject)
PmyObject = ^TmyObject;
If I have a procedure with
Flist.add(myobject)// suspicious line 1
Is the suspicious line above correct or could it cause a bug ? As Myobject is essentially a pointer It should be ok and it is accepted by the compiler but there might be something wrong with this coding.
Some more : assume I want to access to the object pointed by Flist.items consider the two following possibilities :
Are they both correct ?
Thanks in Advance.