unit fStudentVO;interface
      type
      StudentVO  = class;
      private
           studentID : string;
           studentName : string;
           birthday : string;
      public
           function getStudentID:string;
           procedure setStudentID(studentID:string);
      end;
implementation
           function  Student.getStudentID():string;
           begin
                 Result := studentID;
           end;           function Student.setStudentID(studentID:string);
           begin
                  shelf.studentID := studentID;
           end;end.看看有什么错误。

解决方案 »

  1.   

    function  Student.getStudentID():string;
    不用括号
      

  2.   

    function  Student.getStudentID(): string;
    无参数时这个括号可以省略,当然也可以写function Student.setStudentID(studentID: string);
    begin
      shelf.studentID := studentID;
    end;
    是Self.studentID := studentID;吧,这个形参studentID最好名字不要和类里的字段变量一样,比如可以叫AStudentID,清楚一些
      

  3.   

    unit fStudentVO;interface
          type
          TStudentVO  = class;
          private
               studentID : string;
               studentName : string;
               birthday : string;
           public
               constructor create();overload;
               constructor create(studentVO:TStudentVO);overload;
               destructor destory();virtual;
               function getStudentID:string;
               procedure setStudentID(aStudentID:string);
          end;
    implementation
               function  TStudentVO.getStudentID():string;
               begin
                     Result := studentID;
               end;           function TStudentVO.setStudentID(aStudentID:string);
               begin
                      Self.studentID := aStudentID;
               end;end.
    请帮忙查看
    谢谢
      

  4.   

    unit fStudentVO;interface
    type
    TStudentVO = class;
    private
    studentID : string;
    studentName : string;
    birthday : string;
    public
    constructor create(aid,aname,adate:string);overload;destructor destory();virtual;
    function getStudentID:string;
    procedure setStudentID(aStudentID:string);
    end;
    implementation
    function TStudentVO.getStudentID():string;
    begin
    Result := studentID;
    end;function TStudentVO.setStudentID(aStudentID:string);
    begin
    if studentid<> astudentid then
       studentID := aStudentID;
    end;end
      

  5.   

    dinglinger(叮当) 
    VCL源码的风格。呵呵
      

  6.   

    unit fStudentVO;interfacetype
      StudentVO = class;
      private
        studentID: string;
        studentName: string;
        birthday: string;
      public
        function getStudentID: string;
        procedure setStudentID(studentID: string);
      end;implementationfunction StudentVO.getStudentID(): string;
    begin
      Result := studentID;
    end;procedure {function} StudentVO.setStudentID(studentID: string);
    begin
      s{h}elf.studentID := studentID;
    end;end.
      

  7.   

    //等价于:
    Type
      Student = Record
        studentID: String;
        studentName: String;
        birthday: String;
    End;//这个使用类没有必要,因为只是有数据成员或者等效于只有数据成员。