[fpc-pascal] Overriding properties

Timothy Groves the.tail.kinker at gmail.com
Wed Jul 9 18:42:28 CEST 2014


Is there any way to override the type of a property?  As an example, if 
I have written a list class:

type
     tList = class (tObject)
         private
             t_current : tObject;
             t_items : array of tObject;
         public
             property Current : tObject read t_current write t_current;
     end;

(this example is clearly not complete) and I want to create a descendant 
type that uses a different object, without worrying about typecasting.  
Is there a way to override Current?  I tried generics, but using such 
renders me unable to access the list items' properties, making it 
impossible to sort the list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140709/09de1ddf/attachment.html>


More information about the fpc-pascal mailing list