[fpc-devel] Warning: Constructor should be public
Léo Willian Kölln
leokolln at gmail.com
Tue Apr 7 13:20:02 CEST 2009
On Mon, Apr 6, 2009 at 10:15 PM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> 2009/4/6 Flávio Etrusco <flavio.etrusco at gmail.com>:
>> Actually, your constructor has the same signature as 'TObject.Create',
>> so it should show a 'lower visibility' warning in Delphi, doesn't it?
>
> Correct, Delphi should also give this warning.
If it was a visibility "escalation" problem i agree, but Delphi Did
Noy complain about this one (and yes, Delphi complains if this happens
for other visibility problems).
And, i don't put an override to the constructor, so in my class the
constructor is really a virtual override of the TObject.Create?
And, as Flavio Etrusco said:
> But, indeed, FPC shows the warning (should be public) for all
> constructors, even if you're not hiding from the parent class, and I
> always found this a (minor) annoyance.
And it's true, it always complain!
The problem in this case is not a break of contract (class interface),
in my opinion is a problem of compiler interpretation, it Always
require constructors to be Public, we just need read the warning
message again: "Warning: Constructor should be public"
Otherwise (break of contract), it would be an error right?
Léo Willian Kölln
More information about the fpc-devel
mailing list