还是说一定得在继承于GetRecordsEx  的类的构造函数中,显式用super对每一个构造函数写调用代码?

解决方案 »

  1.   

    super() in parent Class, that's ok.
    It's basic knowledge, I'm sure you may take a good reading in basic book (e.g. Thinking In Java
      

  2.   

    楼主看看JAVA基础吧.构造函数是不能继承的, 只能一层一层的super()
      

  3.   

    那即是说得在GetMysqlRecords 中一定得这样?:
    public class GetMysqlRecords extends GetRecordsEx 
    {
    public GetMysqlRecords(dbconn.Getconn dconn)
    {
    super(dconn);
    }//对每一个父类的构造函数封装public GetMysqlRecords(Connection dconn)
    {
    super(dconn);
    }//对每一个父类的构造函数封装 public initpar()
    {
      

  4.   

    子类的构造函数中,如果第一个语句没有用super显示地调用父类的构造方法,编译器会默认的在构造方法中,用super()语句调用父类的那个不带参数的构造方法,如果父类所有的构造方法都带参数的话,那么编译器会报错!
      

  5.   

    用super就好了啊,否则会自动调用超类的无参构造函数
      

  6.   

    因为你的GetMysqlRecords 继承了 GetRecordsEx,所以new GetMysqlRecords 的对象时,先执行的是父类的构造函数!由于你的父类中有很多构造函数!所以你必须用super来指定到底使用哪一个!
     
      

  7.   

    用super就好了啊,否则会自动调用超类的无参构造函数