lecture04-2-继承及多态性-例程.pptVIP

  • 1
  • 0
  • 约 17页
  • 2017-06-17 发布于湖北
  • 举报
Lecture 4 Inheritance Polymorphism 1. Inheritance (继承) 2. Polymorphism (多态性) E55 -1 (testsuper) public class TestSuper { public static void main(String args[]) { D200_Card my200 = new D200_Card(); my200.balance = 50.0; System.out.println(“父类被隐藏的金额为: +my200.getBalance()); if(my200.performDial()) System.out.println(“子类的剩余金额为:+ my200.balance); } } E55 -2 (testsuper) abstract class PhoneCard { double balance; abstract boolean performDial(); double getBalance() { return balance; } }

文档评论(0)

1亿VIP精品文档

相关文档