作者luyota (吉他手)
看板b94902HW
標題Re: [OOP ] 小問題
時間Mon Apr 24 23:55:29 2006
我試了一下
執行java test
結果是:
this is A int x
this is B int x
this is B
class A{
A(int x){
System.out.println("this is A int x");
}
A(){
System.out.println("this is A");
}
}
class B extends A{
int t=3;
B(){
this(0);
System.out.println("this is B");
}
B(int x){
super(x);
System.out.println("this is B int x");
}
}
class test{
public static void main(String[] s){
B b=new B();
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.203.49.63
※ 編輯: luyota 來自: 210.203.49.63 (04/25 00:04)
→ luyota:修文過後才是對的XD 04/25 00:04
推 dongogo:3Q~ 04/25 00:11