BP seems to allow overriding a public method with a private one (and vice versa). Does this seem reasonable?
What do Delphi and other compilers do?
At first sight, I'd rather forbid this in GPC (as usual, with an exception in `--borland-pascal', but perhaps a warning even there?).
program Foo;
type a = object procedure p; end;
b = object (a) private procedure p; { ??? } end;
procedure a.p; begin end;
procedure b.p; begin end;
begin end.
Oh, wait a second, it gets really strange ...
unit U;
interface
type a = object procedure p; end;
b = object (a) private procedure p; end;
implementation
procedure a.p; begin WriteLn ('a.p') end;
procedure b.p; begin WriteLn ('b.p') end;
var v: b;
begin v.p end.
program Foo;
uses U;
var v: b;
begin v.p end.
Under BP, this says:
b.p a.p
What does it mean actually? It means that `b' has *two* methods called `p'. Within the unit, one of them shadows the other, and outside of the unit, the first one is hidden (or non-existent because not exported), and the second one becomes visible. That's crazy, isn't it?
Frank