我在教程上看到一段代码如下:
public class student(){....}
public class studentDAO{
   public student findstudent(string usename,string password){......}}
请问后面这句定义的是student的类函数?后面这句定义的是一个新类还是一个函数啊?我是新手,请告诉我一下,谢谢
 

解决方案 »

  1.   

    studentDAO是一个新类 里面有个findstudent方法  studentDAO是对有关student类的操作封装. 例如在数据库中查找 删除 更新 添加student实体,都封装在studentDAO中当然这2个类都是public的  不能定义在一个文件中DAO:data access object
      

  2.   

    public class student(){....}//定义了一个类: student
    public class studentDAO{//又定义了一个类:studentDAO
      public student findstudent(string usename,string password){......}//此处定义了一个函数。
    }
      

  3.   


    public class student(){....} 
    public class studentDAO{ 
      public student findstudent(string usename,string password){......}}//定义一个函数,返回值类型是一个Student对象 
      

  4.   

    public class student(){....} //定义了一个student类
    public class studentDAO{       //定义了一个studentDAO类
      public student findstudent(string usename,string password){......}
           //这就是一个函数啊!但是返回的是student类的对象(返回类型,换成int你可以理解,不一样吗?)

       //提示:类名规范的写法是第一个字母大写啊!
      

  5.   

    studentDAO通常用于封装对数据库的操作,findstudent(string usename,string password)方法用于通过参数从数据库中查找对应的记录返回对应的对象