Hello together!

I'm currently trying to implement the overloading of methods in class helpers, but I now have the problem that I don't know where I should touch the compiler. So my question is the following: How does overloading methods that are defined in different (but related) classes work in the compiler?

Following example:

TClass1 = class
  procedure Test(aValue: Integer); overload;
end;

TClass2 = class(TClass1)
  procedure Test(aValue: String); overload;
end;

var
  c: TClass2;
begin
  c.Test(42);
end.

Where does the compiler decide which method to call? And how does the compiler know which methods are available? The latter question can be understand as: Does the compiler search the correct symtable (in this case that for TClass1) when it parses the factor "c.Test" or does it resolve that already when parsing the definition of TClass2?

I'll continue searching the correct spot nevertheless.

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to