[fpc-devel] Warning: Constructor should be public

Léo Willian Kölln leokolln at gmail.com
Mon Apr 6 22:37:24 CEST 2009


No.
See my singleton example:

TLoggerGeral = class
  private
  {$IFDEF WINDOWS}
    class var FInstance : TLoggerGeral;
  {$ELSE}
    {$STATIC on}
    FInstance : TLoggerGeral; static;
  {$ENDIF}

    constructor Create;

  protected
    pCritSection    : TCriticalSection;
    pLogarDatas     : boolean;
    pLogarTipos     : boolean;
    pArquivoDestino : TextFile;
    saidaConsole    : boolean;

    class function getData: String;
    class function tipoText(tipo: ETipoMensagem): String;
    class procedure executaOperacaoPrioridade(tipo: ETipoMensagem);

  public
    destructor Destroy; override;
    class function GetInstance: TLoggerGeral;
    class procedure recebeMensagem(const mensagem: String; tipo:
ETipoMensagem = NORMAL);
end;

A normal singleton and it complain!

Léo Willian Kölln


On Mon, Apr 6, 2009 at 4:41 PM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
>> Simply question. Why?
>
>
> What did you do, try and lower the visibility of the constructor?  If
> so, that is also not allowed in Delphi as far as I know.
>
> Regards,
>  - Graeme -
>
>
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>



More information about the fpc-devel mailing list