public class TheOne {
public class TheInOne{
TheInOne(int n){
}
}
}public class TheTwo extends TheOne.TheInOne{
TheTwo(TheOne to,int n){
to.super(n);
}
}请问to.super(n);这个语法怎么解释?
如果吧super理解为是TheOne父类执行构造函数来绑定对象显然不通啊
public class TheInOne{
TheInOne(int n){
}
}
}public class TheTwo extends TheOne.TheInOne{
TheTwo(TheOne to,int n){
to.super(n);
}
}请问to.super(n);这个语法怎么解释?
如果吧super理解为是TheOne父类执行构造函数来绑定对象显然不通啊
to.super(n);
}TheOne 的实例,到底是子类(TheTwo)还是本身(TheOne).
public class TheInOne{
TheInOne(int n){
System.out.println(n);
}
}
}
public class TheTwo extends TheOne.TheInOne{
TheTwo(TheOne to,int n){
to.super(n);
}
}
public class TODO {
public static void main(String[] args) {
TheOne to=new TheOne();
TheTwo tt=new TheTwo(to,10);
}
} 主要我不理解的地方就是TheTwo和TheOne应该说是没有直接关系的,那为什么TheOne的对象调用super构造函数会是调用他内部类TheInOne的构造函数