<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 14-07-09 12:57 PM, Sven Barth wrote:<br>
</div>
<blockquote
cite="mid:CAFMUeB9FtkdtoBptvvQQWK3EKa2fKNhkQdnGwQzYd28cf2_WnA@mail.gmail.com"
type="cite">
<p>Am 09.07.2014 18:43 schrieb "Timothy Groves" <<a
moz-do-not-send="true" href="mailto:the.tail.kinker@gmail.com">the.tail.kinker@gmail.com</a>>:<br>
><br>
> Is there any way to override the type of a property? As an
example, if I have written a list class:<br>
><br>
> type<br>
> tList = class (tObject)<br>
> private<br>
> t_current : tObject;<br>
> t_items : array of tObject;<br>
> public<br>
> property Current : tObject read t_current write
t_current;<br>
> end;<br>
><br>
> (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. </p>
<p>Normally you simply declare the property anew in your child
class. Look at TObjectList from unit contnrs for an example.<br>
In your specific case you'll need a Getter-method that returns
"TWhatEverSubclass(inherited Current)".</p>
</blockquote>
Thanks, that helped me figure it out.<br>
<blockquote
cite="mid:CAFMUeB9FtkdtoBptvvQQWK3EKa2fKNhkQdnGwQzYd28cf2_WnA@mail.gmail.com"
type="cite">
<p>What exactly is your problem with using generics?</p>
</blockquote>
I can't access properties of whatever data type I used to
specialize. So it's difficult to write a class that contains a
list, that allows me to sort that list.<br>
</body>
</html>