>From time to time I get the error, "only class methods can be referred with 
>class references".  While always managed to get a workaround, I am still not 
>able to understand exactly when this happens and why. Example:

type
  TmyClass = class(TObject)
  private
    ..
  public
    constructor Create; overload;
    constructor Create(AParam : TAny); overload;
    constructor Create(AParam : TAnother); overload;
   ...
   procedure DoImportant(...)
  ...
  end;

procedure TmyClass.DoImportant(...);
var
  Temp : TmyClass;
begin
  ...
  Temp := TmyClass.Create(AParam); // error

Calling the same constructor from a separate unit, everything is fine, without 
error. Can somebody deliver the clue?

Thanks in advance
Wolfram

BTW: Of course, overloading requires unique param type lists. But why is it 
impossible to overload functions by unique result type?

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to