Board index » delphi » can't create array in class?

can't create array in class?

Barry,
You need to do
q:=qclass.create;

HTH
Allan

Quote
> This is a wierd problem, but when I create an array inside
> a class, the program crashes. Here is an example:

> (* begin example *)
> type
>     qclass = class (TObject)
>              public
>                    d: array[1 .. 100] of integer;
>              end;

> var
>    q: qclass;
>    i: integer;

> begin

>      q.create;
>      for i:=1 to 100 do
>         q.d[i]:=i;

> end.
> (* end example *)

 

Re:can't create array in class?


Hi all,

This is a wierd problem, but when I create an array inside
a class, the program crashes. Here is an example:

(* begin example *)
type
    qclass = class (TObject)
             public
                   d: array[1 .. 100] of integer;
             end;

var
   q: qclass;
   i: integer;

begin

     q.create;
     for i:=1 to 100 do
        q.d[i]:=i;

end.
(* end example *)

Any clues ?

---
Barry Brannan
barr...@southcom.com.au

Re:can't create array in class?


On Thu, 14 Nov 1996 03:16:29 +1100, Barry Brannan

Quote
<barr...@poboxes.com> wrote:

>var
>   q: qclass;
>   i: integer;

>begin

>     q.create;

this line is wrong:
use
q := qclass.create;
instead

hope this helps
  Meikel Weber
make sure you visit my homepage
http://ourworld.compuserve.com/Homepages/meikel/mew.htm

Other Threads