I need to create a descendant of TStringList class, which has the same functionality as TstringList class, but for each string/object from the list to have an id and subid elements.
Is this possible by inheriting the TStringList class, or I need to create a new class and implement the behavior I need.
LE: I also need the Objects property, so I can not store in the list a pointer to a structure.
From inspecting the TStringList class source, I think it is possible to inherit the TStringList class directly, by adding another
FListIDs: PStringItemListIDs(similar to theFList: PStringItemList) whereTStringItemIDsis a record ofFID, FSubID: Integer(assuming data type is Integer).Next you need to override each
TStringListmethod that involvesFListi.e.:Add,Clear,Delete,Insert, etc… where you will handleFListIDsbeing added or removed.Finally create index properties:
ID,SubIDwith getter and setter functions. e.g:The getter and setter functions will get or set
FListIDs.