Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-09

as keyword behaivor

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Matthias K.

Hi,

Its quite a while since i last used the "as" Keyword but it seems to be broke somehow.
In the following code i've got a compiler error: Illegal parameter list in the line with the star,
at the opening Brace. A Cast ( T8BSetObject(ASet).FSet ... ) works fine.

type TBaseSet = set of Char; TSetObject = class public procedure Union( ASet: TSetObject ); virtual; abstract; end; T8BSetObject = class( TSetObject ) private FSet: TBaseSet; public procedure Union( ASet: TSetObject ); override; end; .. procedure T8BSetObject.Union( ASet: TSetObject ); override; begin * Result := FSet + ( ASet as T8BSetObject).FSet; end; -- regards, maka
Matthias K.
to Matthias K.

Sorry for double post, just for correction

Matthias K. wrote 26 lines
Hi, Its quite a while since i last used the "as" Keyword but it seems to be broke somehow. In the following code i've got a compiler error: Illegal parameter list in the line with the star, at the opening Brace. A Cast ( T8BSetObject(ASet).FSet ... ) works fine. -- type  TBaseSet = set of Char;  TSetObject = class    public      procedure Union( ASet: TSetObject ); virtual; abstract;  end;  T8BSetObject = class( TSetObject )    private      FSet: TBaseSet;    public      procedure Union( ASet: TSetObject ); override;  end; .. procedure T8BSetObject.Union( ASet: TSetObject ); override; begin *  Result := FSet + ( ASet as T8BSetObject).FSet;

FSet := FSet + (ASet as T8BSetObject );
.. it was just a fast rewrite of the actual code, dont mind other faults. the problem line is here

Show quoted text 7 lines
end; -- regards,  maka