[Lazarus] inherited in autocode

Carlos Eduardo S. M. carlos70esm at gmail.com
Sat Jan 12 19:18:21 CET 2019


On Fri, 11 Jan 2019 11:54:27 +0100 (CET), Michael Van Canneyt wrote:

> Hi,
>
> Please check the TStrings descendents in
>
> lcl/interfaces/qt5/qtobjects.pas (Line 4763)
> ide/inputhistory.pas (Line 676)
> components/fpvectorial/docxvectorialwriter.pas (line 414)
> lcl/interfaces/cocoa/cocoatextedits.pas (line 1146)
>
> They are not calling the inherited constructor.
> As a result, LoadFromFile() will crash, since no default encoding is present.
> (the default encoding is set in the constructor)
>
> Unless you know what you are doing, you must always call the inherited constructor,
> if there is one. You must give the parent class the chance to initialize itself
> correctly. It's not because a particular constructor is empty today, that it will be
> empty tomorrow.
>
> Michael.
>
> PS. And yes, this requirement*is*  Delphi compatible.

Hello!

What if the line "inherited;" is automatically included when using code 
completion (<Ctrl><Shift>C) for constructor, destructor, CreateForm, 
DestroyForm, etc.? Instead of

    begin

    end;

it may be

    begin

        inherited;

    end;

Carlos Eduardo S. Matuzaki



---
Este email foi escaneado pelo Avast antivĂ­rus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190112/bfa653b4/attachment.html>


More information about the lazarus mailing list