I have a question regarding the use of interfaces.
if I have 2 interfaces
IListtem = interface
...
end;
IList = interface
...
property Items[Index :Integer]:IListItem read GetItems; default;
procedure GetStrings(Strings :TStrings);
end;
and I declare a class
TListableList = class(TInterfacedObject,IList,IListItem)
end;
This should allow lists of lists. However when I retrieve the first item from the
top level list I recieve an interface of type IListItem and I need to use it as a
IList to access the GetStrings method.. I cannot do this.. I cannot cast it to
IList (I suspect that casting of interface type to interface type is not legal) and
I cannot use the AS or IS operators since they apparently don't apply to
interfaces without GUIDs for the Query interface method to use. So:
(A) am I going about this right
(B) how do you generate a unique GUID
(C) Can you then use AS to legally cast between 2 interfaces. (all help examples
show casting between a class and an interface).
Also should I be implementing the IListItem interface as a base class and use
delegation to implement the behaviour or is this not the preferred methodology.
--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz