[fpc-pascal] Is there a way to avoid class casting?

Horacio Jamilis hjamilis at pymesoft.com.ar
Tue Jul 28 17:20:23 CEST 2009


Thanks for the answer but... the problem is more complicated...

Even if I create a descending class for each TLinkedObjectProperty... I 
will not be able to use them...

Because I have 1 class per unit, y can´t have references to the item 
class in the interfase of the new class, because this way I will have a 
lot of circular references

I don´t see a solution... except keeping casting :-(

Horacio from Argentina


Graeme Geldenhuys escribió:
> Horacio Jamilis wrote:
>> so, I can use... mylinkedproperty.obj.[prop] ... beeing [prop] any 
>> property of the object that is of class LinkedObjectClass, and 
>> avoiding to type TMyLinkeddObjectClass(mylinkedproperty.obj).[prop] ???
>
> You can define TMyLinkeddObjectClass and override the property types 
> so casting is only done in that class's implementation. All your 
> instances of TMyLinkeddObjectClass doesn't have to do casting then.
>
> Regards,
>   - Graeme -




More information about the fpc-pascal mailing list