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.

Imagine how confusing it will be if you code was a library of some sorts
and other developers had to use it. In a inherited class, you have
public visibility to the constructor or some other method, and then
suddenly in the descendant class the methods are hidden from the
developer??  Not a good idea.

You can try out the code and see what I mean. Even in Delphi you cannot
reduce a methods visibility, only make it more visible.

In your code you posted, you cannot hide the constructor (one of them
will always be visible). And it will be like that for both Delphi and
FPC no matter if you try and hide the constructor or not. The default
TObject.Create constructor is *always* visible from Public onwards.


But like Jonas said, in newer compiler versions you can hide compiler
messages, but that doesn't change the flaw in your code.

  raise EAssertError.Create;

is perfectly legal, and will by-pass whatever you intended in your
CreateFromLine() constructor.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to