[fpc-pascal]Bug with virtual methods
peter at freepascal.org
Tue Dec 31 13:16:43 CET 2002
>> That is correct behaviour of the compiler. The compiler only searches in
>> the scope of C2 for M1. It is the same as with 2 units. U1 and U2
>> of C1 and C2.
> If the two methods have different names, the program compiles too. The
> compiler 'forgets' all overloaded methods except that one which is
> Why that? Shouldn all methods be treated as "seperate" ones? So, two
> methods with different names are "equally different" as two methods with
> just different parameters?
It is the scope in which the compiler searches for symbols. When there
would be no scope then you will end up with ambigious situations like:
And with the overload directive to support cross unit and inherited
overloading we've found a good solution. And also very important is that
it is delphi compatible.
More information about the fpc-pascal