Waldek Hebisch wrote:
Peter N Lewis wrote:
At 8:05 +0200 22/6/05, Waldek Hebisch wrote:
In BP OOP it shadows. (It doesn't have `override', or if you will, it's implicit.)
IIUC in Delphi it shadows (creates new method with the same name), but in BP it just overrides.
Could you explain the difference between shadow and override? Or perhaps it doesn't make sense with Mac's "always virtual" concept?
For static methods shadow and override give the same. Consider:
type a = class procedure dop; virtual; { virtual just for consitency} procedure p; virtual; end; b = class (a) procedure p; virtual; end;
procedure a.dop; begin p end;
procedure a.p; begin writeln('a.p') end;
procedure b.p; begin writeln('b.p') end;
the in the case of overriding `b.dop' prints `b.p'. but in the case of shadowing it just prints `a.p', because `b.p' beeing a new method gets a new VMT slot, but `b.dop' calls old slot (so old method).
And Delphi does the latter? (Seems a bit contrary to the purpose of being virtual IMHO.)
Frank