Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: create c# like classes in delphi

  1. #11

    create c# like classes in delphi

    That syntax,

    operator /(a: tvector4f; b: single)result: tvector4f;
    with the name of result variable looks very nice.

  2. #12

    create c# like classes in delphi

    I think the syntax for fpc's way of overloading looks weird but I'm able to make it easily maintainable this way:

    [pascal]
    {$IFDEF FPC}
    operator -(a: single; b: tvector4f) result: tvector4f;
    {$ELSE}
    class operator tvector4f.Subtract(a: single; b: tvector4f): tvector4f;
    {$ENDIF}
    begin
    result := sub(vector4f(a,a,a,a), b);
    end;[/pascal]
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #13

    create c# like classes in delphi

    When we implemented operator overloading years ago, we decided not to diverge the language more than necessary and took the syntax from GNU-Pascal. Unofrtunately, Borland decided that copying C# is more important than Pascal compiler compatibility :evil:

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •