Using QueryInterface (or in D5, Supports) will enable you to determine
whether a particular interface supports another - this is generally more
useful than determining whether it inherits from it directly. Who needs
inheritance when you're using interfaces?! :) You can also go MyInterface
:= TMyObject AS IMyInterface; (returns nil if TMyObject doesn't support it).
But no, there doesn't appear to be a way to determine whether one interface
is inherited from another (ie. you can't use IS).
Cheers,
Carl
-----Original Message-----
From: Aaron Scott-Boddendijk [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 27 January 2000 15:10
To: Multiple recipients of list delphi
Subject: [DUG]: Interface Types
With Objects we have Class Types so the below is possible
TMyObject = class(TObject)
public
Spam :Integer;
end;
TMyObjectClass = class of TMyObject;
procedure Inherits(C :TClass; O :TObject):Boolean;
begin
result := O is C;
end;
Can this be donw with interfaces
IMyObject = interface(IUnknown)
function GetSpam:Integer;
end
procedure Inherits(I :???; O :IUnknown):Boolean;
begin
result := O is C; // (or collecting the GUID of I and O.queryInterface for
an HResult)
end;
It's the end of the day and nearing the end of the week and I'm sure I'm
missing something
obvious...
--
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
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz