Quick Question about TInterfacedObject:

Quick Question about TInterfacedObject:

if I subclass TInterfacedObject is it necessary to include an interface or it is implicitly assumed the IInterface?

So, are these two the same:

TmyClass = class (TInterfacedObject)

and

TmyClass = class (TInterfacedObject, IInterface)

Thanks

Comments

  1. So, basically if we inherit every class from TInterfaced we introduce automatic life management

    ReplyDelete
  2. But IInterface doesn't give you access to any properties or methods in the class, right?

    ReplyDelete
  3. John Kouraklis  No, that was because I used an example that didn't bother with lifetime, to reduce the size of the code, and so focus on the main point.

    The whole point of TInterfacedObject is to have the interface reference count manage the lifetime of the implementing object. That's why it exists.

    What is behind the question.

    ReplyDelete

Post a Comment