关于继承
2012-03-15 15:34
106 查看
package com.pratice1; public class Horse { protected int leg = 0; String name = null; public Horse(int leg){ this.leg=4; this.name = "马类"; System.out.println("马类的构造函数"); } public String getName(){ return name; } }
package com.pratice1; public class WhiteHorse extends Horse { public WhiteHorse(int i){ super(i); System.out.println("白马类的构造函数"); } public static void main(String[] args){ WhiteHorse witheHorse = new WhiteHorse(4); System.out.println(witheHorse.getName()); } }
相关文章推荐
- 关于C++中的虚拟继承的一些总结
- 关于JS的继承
- 关于静态变量的继承
- 关于CSS中的样式继承
- C++ — 关于菱形虚拟继承对象模型的探究
- FiveDay(关于继承强制转换的理解)---可能不正确
- 关于“抽象类是否可继承实体类”的辨析
- 关于继承中构造方法的知识
- 关于对DWR继承测试
- Android关于继承-【属性】和【方法】-多态的探究(我会煮很多栗子的)
- 关于VB.NET基类继承、重载、隐藏的总结归纳
- 一个关于继承的程序,求高人解释程序执行过程中内存的数据存储情况
- 关于继承中静态代码块,构造代码块,构造函数执行顺序
- 关于PHP的继承相关知识点
- 关于super关键字 继承 覆盖和隐藏 static
- 关于子类为何不能继承父类构造方法的几点解释
- 关于继承,函数的继承
- Effective C++: 关于继承中的函数的访问级别的修改.
- 关于类继承与数据库表设计的问题
- 关于C++中的虚拟继承的一些总结