I have a Delphi (2007) class function like this:
Class Function InitGlobal : TForm; Overload; Virtual; Abstract;
in some descendant class I try to:
Class Function InitGlobal : TDescendentForm; Overload; Override;
But Delphi complains that TDescendentForm.InitGlobal
differs from the previous declaration (despite the pressence of the "Overload" directive).
I guess that function result types can not be overloaded. Which is the correct way of define such overloading if any?
I checked Function overloading by return type?, but it mentions the cons and pros of making such overloading with no mention to Delphi.
overload
oroverride
, but you can't do both simultaneously. Anoverload
needs to have a different method signature, while anoverride
indicates that the method shall replace the method of the same name from your derived type. Perhaps a more detailed code sample could help further. – Will Marcouiller