Chapter 9 Inheritance and Polymorphism.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Chapter 9 Inheritance and Polymorphism.ppt

Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-222158-6 Chapter 9 Inheritance and Polymorphism Objectives To develop a subclass from a superclass through inheritance (§9.2). To invoke the superclass’s constructors and methods using the super keyword (§9.3). To override methods in the subclass (§9.4). To distinguish differences between overriding and overloading (§9.5). To explore the useful methods (equals(Object), hashCode(), toString(), finalize(), clone(), and getClass()) in the Object class (§9.6, §9.13 optional). To comprehend polymorphism, dynamic binding, and generic programming (§9.7). To describe casting and explain why explicit downcasting is necessary (§9.8). To store, retrieve, and manipulates objects in an ArrayList (§9.9). To implement a Stack class using ArrayList (§9.10). To restrict access to data and methods using the protected visibility modifier (§9.11). To declare constants, unmodifiable methods, and nonextendable classes using the final modifier (§9.12). (Optional) To understand the effect of hiding data fields and static methods (§9.14). (Optional) To initialize data using initialization blocks and to distinguish between instance initialization and static initialization blocks (§9.15). (Optional GUI) To use inheritance in GUI programming (§9.16). Superclasses and Subclasses Are superclass’s Constructor Inherited? Superclass’s Constructor Is Always Invoked Using the Keyword super To call a superclass constructor To call a superclass method CAUTION Constructor Chaining Trace Execution Trace Execution Trace Execution Trace Execution Trace Execution Trace Execution Trace Execution Trace Execution Trace Execution Example on the Impact of a Superclass without no-arg Constructor Declaring a Subclass A subclass extends properties and methods from the superclass. You can also: Add new properties Add new methods Override the methods of the superclass Calling Superclass Methods Overridi

文档评论(0)

gshbzl + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档