[fpc-pascal] not possible add into class helper overloaded variant of some virtual method

ko paka kopaka4 at gmail.com
Mon Nov 18 18:05:41 CET 2013


Hello,

in actual trunk - fpc 2.7.1 -  is not possible to do folloving:

unit uStringListHelper;

{$mode delphiunicode}

interface

uses
  Classes, SysUtils;

type

  { TStringListHelper }

  TStringListHelper = class helper for TStringList
  public
    procedure LoadFromFile(const FileName: string; Encoding: TEncoding);
overload;
  end;


implementation

{ TStringListHelper }

procedure TStringListHelper.LoadFromFile(const FileName: string;
  Encoding: TEncoding);
begin

end;

end.




program testoverloadinclasshelper;

{$mode delphiunicode}

uses
  Classes, SysUtils, uStringListHelper;

var
  m: TStringList;
begin
  m := TStringList.Create;
  m.LoadFromFile('somefile.txt', TEncoding.UTF8);
end.


When I try to compile it, error "Wrong number of parameters ...." will be
shown. Based on documentation I found (
http://www.freepascal.org/docs-html/ref/refse50.html) it should be
possible. Is it a bug or am I missed something ?

One point more - when I had defined class helper type in same unit as main
program (so not in separate unit uStringListHelper), compiler behavior was
like there is no class helper defined. Is this correct as well ?

regards
tomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131118/67a9ed6c/attachment.html>


More information about the fpc-pascal mailing list