[Lazarus] How to cast a Interface to a Object in Lazaeus

Michael Van Canneyt michael at freepascal.org
Fri Mar 13 11:06:19 CET 2015



On Fri, 13 Mar 2015, Martin Schreiber wrote:

> On Friday 13 March 2015 10:49:43 aradeonas wrote:
>> OK,So in the end how can I cast a Interface to a Object in Lazarus?
>>
> I usually add a "function getinstance(): <theBaseImplemetationClass>" to the
> interface definition.

Which goes completely against the very purpose of interfaces.

If you need this, you should not be using interfaces to begin with.

The only possible excuse is an external requirement to use interfaces.

Michael.




More information about the Lazarus mailing list