Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"is" operator equivalent for interfaces?

0 views
Skip to first unread message

masonw...@gmail.com

unread,
Jul 21, 2008, 12:05:35 PM7/21/08
to
I'm trying to make sure that any object passed to the write parameter
of a property implements a certain interface. The obvious way for
checking inheritance, the "is" operator, doesn't seem to work. Is
there a different way to do it?

procedure TEngineData.setEngine(const Value: TEngine);
begin
assert(value is IEngine); //compiler doesn't like this
FEngine := Value;
end;

Any help would be appreciated.

BRoberts

unread,
Jul 31, 2008, 8:32:29 PM7/31/08
to
<masonw...@gmail.com> wrote in message
news:bf992d9f-7587-4aca...@t12g2000prg.googlegroups.com...


Interfaces can be bound dynamically at runtime. You can wrap an assignment
using the AS operator in a try except and trap the error at runtime. Can you
not simply use an iEngine parameter?

0 new messages