- 博客(3)
- 收藏
- 关注
原创 面向对象之多态性
面向对象多态性 1.向上转型 多态性: 父类引用于子类的对象 class Person{ private String name; private int age; } class Man extends Person{ private String occupation; } class ManTest{ Person p = new Man(); //多态 向上转型 } 2.向下转型 有了多态性以后,内存实际上加载了子类特有的属性和方法,但是由于
2021-03-10 11:38:29
243
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅