如题 

解决方案 »

  1.   

    Student=class(TObject)
      private
        nums:array[1..5] of integer;//某个学生的各科成绩;
        name:string;//某个学生名字;
      public
        property nums:integer read GetValue write SetValue;
        property name:string read GetName write SetName;
        procedure Input();
        procedure Total();
        procedure Average();
      end ;
    好象有错误。。我真的不知道dephhi的属性定义这么麻烦
      

  2.   

    需要定义相应方法
    procedure Student.SetName(string);
      

  3.   

    Student=class(TObject)
      private
      public
       name:string;
        num1,num2,num3,num4,num5:integer;
        list:array[1..90,1..5] of string;
        namelist:array[1..90] of string;
        procedure Input();
        procedure Total();
        procedure Average();
      end ;
    procedure Student.Input();
      var
      Myfile: Textfile;
      S: String;
      Ch: Char;
      i:integer;
      j:integer;
      temp:string;
     begin
      S := '';
      i:=1;
      Assignfile(Myfile, 'records.txt'); //FileName是文件名
      reset(Myfile);  try
        while not Eof(Myfile) do
        begin
          Read(Myfile,Ch);
          S := S + Ch;
          temp:=CH;
          namelist[i]:=temp;
          i:=i+1;
        end;
      finally
        Closefile(Myfile);
      end;
     end;
    procedure TForm1.FormCreate(Sender: TObject);
    var mystudent:Student;
    begin
     mystudent:=Student.Create();  mystudent.Input();//这里发生错误。到底为什么。不是已经定义好。直接跳用类的方法吗
    end;