Results 1 to 3 of 3

Thread: Class type expected

  1. #1
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default Class type expected

    I'm whipping up something for my dad for evony (a game he plays), and i decided to take a crack at learning types while i'm at it.

    here's the portion of it that is giving me trouble:
    Simba Code:
    program farm;

    type
      TCoord = record
        Coordinats: array[0..1] of Integer;
      end;
      TTown = array[0..8] of TCoord;

    var
      Towns: array of Boolean;
      Coords: array of TTown;

    procedure SetVars;
    begin
      Towns := [False, False, False, False, False, False, False, False, False, False];
      SetLength(Coords, 8);
      with Coords[0] do
      begin
        Coords[0] := [0, 0];
        Coords[1] := [0, 0];
        Coords[2] := [0, 0];
        Coords[3] := [0, 0];
        Coords[4] := [0, 0];
        Coords[5] := [0, 0];
        Coords[6] := [0, 0];
        Coords[7] := [0, 0];
        Coords[8] := [0, 0];
      end;

      with Coords[1] do
      begin
      end;

      with Coords[2] do
      begin
      end;

      with Coords[3] do
      begin
      end;

      with Coords[4] do
      begin
      end;

      with Coords[5] do
      begin
      end;

      with Coords[6] do
      begin
      end;

      with Coords[7] do
      begin
      end

      with Coords[8] do
      begin
      end;

      with Coords[9] do
      begin
      end;

    end;

    begin
    end.

    And I get this error
    Progress Report:
    [Error] (19:18): Class type expected at line 18
    Compiling failed.


    I don't understand

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    pascal Code:
    with Coords[0] do
      begin
        Coords[0] := [0, 0];
        Coords[1] := [0, 0];
        Coords[2] := [0, 0];
        Coords[3] := [0, 0];
        Coords[4] := [0, 0];
        Coords[5] := [0, 0];
        Coords[6] := [0, 0];
        Coords[7] := [0, 0];
        Coords[8] := [0, 0];
      end;

    Should be Coordinates[0..8], I think.

    More than that, but he solved it after msn I think.
    Last edited by i luffs yeww; 12-30-2010 at 08:01 AM.

  3. #3
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    after a bit of facepalming, i did it this way instead, then used a series of with..do statements
    Simba Code:
    type
      TCoordinate = record
        x: Integer;
        y: Integer;
        UseThis: Boolean;
      end;
      TTownList = record
        Coordinates : array[0..8] of TCoordinate;
      end;

      TList = record
        TheList : array[0..9] of TTownList;
      end;


    var
      List: TList;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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