多态(Plolymorphism)
来源:互联网 发布:linux查看ssh端口 编辑:程序博客网 时间:2024/06/02 01:42
public class PolyTest
{
public static void main(String[] args)
{
//Parent parent = new Parent();
//parent.sing();
//Child child = new Child();
//child.sing();
Parent p = new Child(); //多态 :父类的引用指向子类的对象
p.sing();
}
}
{
public static void main(String[] args)
{
//Parent parent = new Parent();
//parent.sing();
//Child child = new Child();
//child.sing();
Parent p = new Child(); //多态 :父类的引用指向子类的对象
p.sing();
}
}
class Parent
{
public void sing()
{
System.out.println("parent is singing");
}
}
class Child extends Parent
{
public void sing()
{
super.sing(); //调用父类的无参函数
System.out.println("child is singing");
}
}
- 多态(Plolymorphism)
- java多态(二)
- 多态(笔记)
- 多态(Polymorphism)
- 多态(Polymorphism)
- 多态(Polymorphism)
- Java 多态(Polymoph)
- Java多态(汇总)
- c++多态(一)
- java多态(二)
- java多态(三)
- 多态(Polymorphism)
- 多态(未完)
- 动态绑定(多态)
- 多态(动态绑定)
- 回顾vb(多态)
- java_多态(1)
- 多态(一)
- 经典编程书籍(C++, 网络, Windows, Linux)
- 学习网络编程的十个步骤
- 进程间通信的方法
- using语句的作用—摘自MSDN
- 第四天(复合类型 · 二)
- 多态(Plolymorphism)
- 在google map下,判断点是否在多边形内的函数
- 素数
- ZOJ 1099HTML
- vim中tab键的相关设置
- double类型小数的二进制转换
- 引用(Peference)
- 第36届ACM大连赛区I题 The Boss on Mars
- 引用2