ICode9

精准搜索请尝试: 精确搜索
  • 多态的弊端2022-08-29 20:02:14

    不转型的话,不能使用子类特有的属性和行为    class Demo_SuperMan { public static void main(String[]args){ Person p=new SuperMan();//父类引用指向子类对象。超人提升为了人 //父类引用指向子类对象,就是向上转型 S

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有