At 7:30 +0200 22/6/05, Frank Heckenbach wrote:
And the question now: what happens if the child tries to make a method with the same name as a parent, but without `override'. Is it an error (like OOP) or maybe just "shadows" parent method?
In BP OOP it shadows. (It doesn't have `override', or if you will, it's implicit.)
But fjf903c.pas is `--mac-pascal', and AFAIK it needs override (right, Peter?), so the test program seems to be wrong without `override'.
Correct, shadowing is not allowed without override in Mac Pascals. A method in a subclassed object must be either:
a) a new name in no parent object, and not have "override" or b) a name in a parent object, with the same parameters (same by type anyway, the formal parameter name is not typically checked, although GPC typically requires the formal names to match), and must have "override"
Looking at the fjf903c.pas test file, yes, procedure p in object b would need "overide", ie:
b = object (a) procedure p; override; end;
Enjoy, Peter.