On Tue, Nov 10, 2009 at 10:56 AM, Graeme Geldenhuys
<gra...@mastermaths.co.za> wrote:
> Anthony Walter wrote:
>> In my opinion the warning should be removed, or at least able to be
>> suppress through a switch. I beginning to make the transition to cross
> The compiler is 100% and I think it should actually raise an Error
> instead of a Warning.
> Your code is flawed. Object Pascal is quite clear regarding visibility
> rules. TObject has a Public constructor. You can only raise the
> visibility from there, not reduce visibility.
>  raise EAssertError.Create;
> is perfectly legal, and will by-pass whatever you intended in your
> CreateFromLine() constructor.

Graeme, I guess the OP didn't want to reintroduce the 'Create'
constructor with lower visibility, just implement a second constructor
with private visiblity.
It can be useful when implementing singletons and factories to avoid
some types of misuse by an unattentive coworker...
IIRC the last time this issue was raised you were on the side for
removing the warning - my opinion too ;-)

fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org

Reply via email to