331929879

继承类


class Father
{
 int age;
 String name;
 void eat()
 {
  System.out.println("吃馍!");
 }
}
class Son extends Father
{
 int height;
 void eat()
 {
  super.eat();
  System.out.println("喝酒");
 }
}
class Ex
{
 public static void main(String args[])
 {
  Son p=new Son();
  Father p1=new Son();
  p1.eat();
  p.eat();
 }
}

posted on 2007-10-16 14:47 小飞 阅读(147) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: