第一章对象入门1.5-1.6(java编程思想第四版)(Chapter 1 introduction of the object 1.5-1.6 (Java programming thought 4)).doc

第一章对象入门1.5-1.6(java编程思想第四版)(Chapter 1 introduction of the object 1.5-1.6 (Java programming thought 4)).doc

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

第一章对象入门1.5-1.6(java编程思想第四版)(Chapter 1 introduction of the object 1.5-1.6 (Java programming thought 4)) 1.5 inheritance: re-use the interface 1.5.1 improve basic classes 1.5.2 equivalence and similar relationships The interchange of more than 1.6 polymorphic objects 1.6.1 dynamic binding 1.6.2 abstract base classes and interfaces 1.5 inheritance: re-use the interface In its own right, the concept of object can bring great convenience to us. It conceptually allows us to encapsulate all kinds of data and functionality. In this way, the concept of problem space can be properly expressed, without any intention to follow the expression of the basic machine. In programming languages, these concepts are reflected in specific data types (using the class keyword). It would be very frustrating to have to make a data type, and if we had to create a new type that would do roughly the same thing. But if you can make use of the available data type and clone it, then add and modify the situation, the situation becomes much more ideal. Inheritance is designed for this purpose. But inheritance is not exactly equivalent to cloning. In the process of inheritance, if the original class (official name is called the base class, the class or the parent class) has changed, the modified clone class (officially called derived class or subclass) will reflect this change. In the Java language, inheritance is achieved through the extends keyword When you use inheritance, you create a new class. This new class not only contains all members of the existing type (although private members are hidden and cannot be accessed), but more importantly, it replicates the interface of the base class. That is, all messages that can be sent to a base class can be sent to a derived class as is. Depending on the message you can send, we can know the type of class. This means that the derived classes have the same type as the base class! To really understand the meaning of object-oriented programming, you must fi

您可能关注的文档

文档评论(0)

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

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

版权声明书
用户编号:6111134150000003

1亿VIP精品文档

相关文档