Sorry, Create is an identifier. constructor TSampleForm.Create(AOwner: TComponent); var Create: Integer; begin inherited; Create := Tag; Caption := IntToStr(Create); end;
Aside from that, if you read you will see I used two identifiers ... one called "Create" and another called ... get this "CreateFromLine". See that? It's a different identifier (it's not the same). Test it out yourself. if 'Create' = 'CreateFromLine' then ; // always evaluates to false As such, the compiler shouldn't issue a warning about constructors must be public. protected constructor CreateFromData(var Data); // there should not be a warning saying CreateFromData must be public It should however issue a waring when you try to alter the visbility of a method: private procedure FreeInstance; override; // warning or error here is expected On Tue, Nov 10, 2009 at 4:35 PM, Paul Nicholls <[email protected]> wrote: > ----- Original Message ----- From: "Anthony Walter" <[email protected]> > To: <[email protected]>; "FPC-Pascal users discussions" > <[email protected]> > Sent: Wednesday, November 11, 2009 1:07 AM > Subject: Re: [fpc-pascal] Compiler Warning: Constructor should be public > > >> Your argument is flawed. Visibility rules apply to identifiers, not >> keywords. >> >> Create // identifier >> CreateFromLine // different identifier >> >> No visibility is being changed by introducing a *new* identifier >> >> raise EAssertError.Create(Msg); // still visible >> raise EAssertError.CreateFromLine(Msg, FileName, LineNumber); // not >> visible >> > <SNIP> > > Hi Anthony, > Sorry, but you are incorrect; "Create" is a method, not an identifier, and > like all methods, it is affected by visibility rules (public, private, > protected). > > cheers, > Paul > _______________________________________________ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
