newclass=ClassFactory.getSubClass(index); 对象本身属性就决定了自己是什么子类了

解决方案 »

  1.   

    我想了解getType(index)的写法,takecare(大厅) 可以谈谈吗?
      

  2.   

    我只是想了解getType(index)的写法,具体做的时候要看情况的。网名坚决不改,表示对那个混帐团体的抗议。
      

  3.   

    这样写可以吗?
    public Object getType(int nResultndex){
    if(nResultndex==0){
    return Class1.class;
    }
    else if(nResultndex==1){
    return Class2.class;
    }
    else{
    return Class3.class;
    }
    }
      

  4.   

    Getting a Class Object
    There are three ways to retrieve a Class object.
    // By way of an object.
    Class cls = object.getClass();
    // By way of a string
    try {
    cls = Class.forName("java.lang.String");
    } catch (ClassNotFoundException e) {
    }
    // By way of .class
    cls = java.lang.String.class;