Hello, I'm new to pointers, and I have a problem that I think is easy to
solve. I get an EAccessViolation when trying to initialize my object with
the Init procedure. The carret points at "elem", or in other words, I think
I'm trying to access M.elem without M being initialized. But M IS
initialized, at least I think so!
So what's wrong?

type
 Main = ^MainType;
 MainType = class
  private
   connect: array[1..maxNum] of Main;
   elem: integer;
  public
   procedure Init;
   procedure KillObj;
 end;

...

procedure MainType.Init;
var
 i: integer;
begin
 elem := 0;
 for i := 1 to maxNum do
  connect[i] := nil
end;

...

procedure Button1Click
var
 M: Main;
begin
 GetMem(M, SizeOf(M));
 G.Init;
 G.KillObj
end;


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to