Waldek Hebisch wrote:
Frank Heckenbach wrote:
Waldek Hebisch wrote:
I have updated my class patch to gpc-2005031. Testing I get failure with fjf903c.pas:
TEST fjf903c.pas: /pom/kompi/gcc/tst44/gcc-3.4.3/gcc/p/test/fjf903c.pas:14: error: method `p', overrides parent method /pom/kompi/gcc/tst44/gcc-3.4.3/gcc/p/test/fjf903c.pas: In main program: /pom/kompi/gcc/tst44/gcc-3.4.3/gcc/p/test/fjf903c.pas:31: error: assignment from incompatible pointer type
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.)
IIUC in Delphi it shadows (creates new method with the same name), but in BP it just overrides.
You can still access the old method by a "class-qualified" name. Or what's the difference between shadowing and overriding? program Foo; type a = object procedure p; end; b = object (a) procedure p; end; procedure a.p; begin WriteLn ('a.p') end; procedure b.p; begin WriteLn ('b.p'); a.p end; var v: b; begin v.p end. Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8