[fpc-devel] Assigning to inherited property calls setter of the child class

Alexander Klenin klenin at gmail.com
Fri May 1 17:17:48 CEST 2009


On Sat, May 2, 2009 at 01:56, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
>> 4) If it has setter named "SetP", do the equivalent of "inherited
>> SetP".
>
> Why?

Because this surprises developers and leads to bugs.
See the issue http://bugs.freepascal.org/view.php?id=13418
(linked from the discussed one) for a recent example.

> "inherited P" should look up P in the ancestor class.
> The setter of P belongs to the internal implementation of
> the class. If you want to access the inherited setter, call it with
> inherited SetP.

Alternative solution would be to issue a warning if
TInherited.SetP contains "inherited P := V" and SetP is virtual.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list