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

Horacio Jamilis hjamilis at pymesoft.com.ar
Tue Jul 28 16:57:20 CEST 2009


Hi,

I am building from some time a OPF, that is working fine for me, but I´d 
like to avoid the big amount of castings I am using...

I have one class on each unit.
Each class contains the properties that represent´s it  :-)
One property kind is TLinkedObjectProperty. This class has a property 
that returns a TObject, pointing to the object the property is 
referencing...
TLinkedObjectProperty has another property called LinkedObjectClass that 
has the class of the linked object.

Is there a way that, each time I reference (by code) ... 
mylinkedproperty.obj ... this obj is taken by the compiler of its 
linkedobjectclass class?
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] ???

Sorry for my poor english and I hope you understand what I mean.

Thanks in advance

Horacio from Argentina.



More information about the fpc-pascal mailing list