import java.ip.*;
public class Patrimony
{
public static void main(string args[])
{
Father father=new Father(200,500);
Son son=new Son(200,300,400,500);
fahter.showProperty();
son.showProperty();
}
}
interface Forebear
{
int legacy=100;
void showProperty();
}
abstract class GrandFather implements Forebear
{
int earning;
GrandFather(){earning=0;}
GrandFather(int ge){earning=ge;}
public void showProperty(){
System.out.println("GrandFather:"+(legacy+earning));
}
}
class Father extends GrandFather
{
int innovate;
Father(){super();innovate=0;}
Father(int fe,int fi){super(fe);innovate=fi;}
public void showProperty()
{
super.showProperty();
System.out.println("Father:"+(legacy+earning+innovate));
}
}
class Son extends Father
{
int lucre;
int legacy;
Son(){super();lucre=0;legacy=0;}
Son(int se,int si,int u,int e){super(se,si);lucre=u;legacy=e;}
public void showProperty()
{
System.out.println("Son:"+(super.legacy+earning+innovate+lucre+legacy));
}
}这个程序运行的结果怎么样
public class Patrimony
{
public static void main(string args[])
{
Father father=new Father(200,500);
Son son=new Son(200,300,400,500);
fahter.showProperty();
son.showProperty();
}
}
interface Forebear
{
int legacy=100;
void showProperty();
}
abstract class GrandFather implements Forebear
{
int earning;
GrandFather(){earning=0;}
GrandFather(int ge){earning=ge;}
public void showProperty(){
System.out.println("GrandFather:"+(legacy+earning));
}
}
class Father extends GrandFather
{
int innovate;
Father(){super();innovate=0;}
Father(int fe,int fi){super(fe);innovate=fi;}
public void showProperty()
{
super.showProperty();
System.out.println("Father:"+(legacy+earning+innovate));
}
}
class Son extends Father
{
int lucre;
int legacy;
Son(){super();lucre=0;legacy=0;}
Son(int se,int si,int u,int e){super(se,si);lucre=u;legacy=e;}
public void showProperty()
{
System.out.println("Son:"+(super.legacy+earning+innovate+lucre+legacy));
}
}这个程序运行的结果怎么样
Father:800
Son:1500