mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 01:30:23 +02:00
* initial revision
This commit is contained in:
parent
6ab93f5ec1
commit
cca4d8ce97
57
tests/webtbs/tw3214.pas
Normal file
57
tests/webtbs/tw3214.pas
Normal file
@ -0,0 +1,57 @@
|
||||
{ Source provided for Free Pascal Bug Report 3214 }
|
||||
{ Submitted by "Mattias Gaertner" on 2004-07-17 }
|
||||
{ e-mail: mattias@freepascal.org }
|
||||
program InvalidOpcode;
|
||||
|
||||
{$mode objfpc}
|
||||
{$H+}
|
||||
{$R+}
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
TMyEvent = class(TObject)
|
||||
public
|
||||
procedure SaveToStream(aStream: TStream); virtual; abstract;
|
||||
end;
|
||||
|
||||
TMyClass = class
|
||||
private
|
||||
function GetEvent(aIndex: integer): TMyEvent;
|
||||
function GetEventCount: integer;
|
||||
public
|
||||
property EventCount: integer read GetEventCount;
|
||||
property Events[aIndex: integer]: TMyEvent read GetEvent;
|
||||
procedure SaveToStream(aDest: TStream);
|
||||
end;
|
||||
|
||||
{ TMyClass }
|
||||
|
||||
function TMyClass.GetEvent(aIndex: integer): TMyEvent;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TMyClass.GetEventCount: integer;
|
||||
begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
procedure TMyClass.SaveToStream(aDest: TStream);
|
||||
var
|
||||
cEvent: Integer;
|
||||
eCnt: Integer;
|
||||
begin
|
||||
eCnt:=EventCount;
|
||||
aDest.Write(eCnt, sizeof(eCnt));
|
||||
for cEvent := 0 to eCnt -1 do
|
||||
Events[cEvent].SaveToStream(aDest);
|
||||
end;
|
||||
|
||||
var
|
||||
M: TMyClass;
|
||||
begin
|
||||
M:=TMyClass.Create;
|
||||
M.SaveToStream(nil);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user