Recent

Author Topic: Class function error ( newinstance)  (Read 4361 times)

Peiman

  • New Member
  • *
  • Posts: 41
Class function error ( newinstance)
« on: March 12, 2009, 09:22:30 pm »
Hi!

For the code bellow this fatal error is raised, what is the problem? Again this code was compiled successfully in delphi :

GDIPAPI.pas(3463,30) Fatal: Syntax error, ";" expected but "." found

code :

type
  TGdiplusBase = class
  public
    class function NewInstance: TObject; override;
    procedure FreeInstance; override;
  end;
 
implementation

// the "." in the next line is where the error occurs
  class function TGdiplusBase.NewInstance: TObject;
  begin
    Result := InitInstance(GdipAlloc(ULONG(instanceSize)));
  end;





Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Class function error ( newinstance)
« Reply #1 on: March 13, 2009, 05:33:13 am »
This full unit compiles fine. Perhaps you miss something?
Code: [Select]
unit gdiplus;

{$mode delphi}

interface

type
  TGdiplusBase = class
  public
    class function NewInstance: TObject; override;
    procedure FreeInstance; override;
  end;

implementation

uses
  Windows;

// the "." in the next line is where the error occurs
class function TGdiplusBase.NewInstance: TObject;
begin
  { I don't know where GdipAlloc comes from, so I need to
    comment the line out }
  // Result := InitInstance(GdipAlloc(ULONG(instanceSize)));
end;

procedure TGdiplusBase.FreeInstance;
begin

end;

end.

 

TinyPortal © 2005-2018