我写了一个类,可是在执行create时,总出现异常,不知谁能帮助我,高分酬谢,不够再加。... TMylist = class(Tobject)
     st1:TStringlist;
     st2:TStringlist;
     procedure create;
     procedure free;
  end;
...
var
    ml:Tmylist;procedure TMylist.create;
begin
   st1 := TStringlist.create;
   st2 := TStringlist.create;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
   ml.create;
end;

解决方案 »

  1.   

    异常在st1:=TStringlist.create发生。
      

  2.   

    TMylist = class(Tobject)
         st1:TStringlist;
         st2:TStringlist;
         procedure create;
         procedure free;
      end;
    ------------
    TMylist = class(Tobject)
         private// 
         st1:TStringlist;
         st2:TStringlist;
         public
          constructor Create; virtual;//procedure create;
          destructor Destroy; override;//procedure free;
      end;
    constructor TMylist.Create// procedure TMylist.create;