第一章对象入门1.5-1.6(java编程思想第四版)(Chapter 1 introduction of the object 1.5-1.6 (Java programming thought 4)).doc
- 1、本文档共12页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 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
您可能关注的文档
- 儿科统考题(Department of pediatrics).doc
- 儿童单纯镜下血尿的诊断途径(The diagnostic pathway of hematuria under the simple mirror of children).doc
- 倒闸操作规程(Reverse operation procedure).doc
- 儿童常见病症(Common disease of children).doc
- 儿童故事之一(One of the children's stories).doc
- 儿童用药(Children's drugs).doc
- 儿童心理学资料04(Child psychology data 04).doc
- 党课考试常考的一些内容(Some of the content of the exam of the party).doc
- 公共营养师2(Public nutritionist 2).doc
- 党的学说和党的建设(The theory of the party and the construction of the party).doc
- 四川省德阳市罗江中学2025届高三考前热身化学试卷含解析.doc
- 山东省枣庄现代实验学校2025届高三下学期第五次调研考试化学试题含解析.doc
- 吉林省长春市十一高中等九校教育联盟2025届高三一诊考试生物试卷含解析.doc
- 2025届江苏省盐城市伍佑中学高考仿真模拟化学试卷含解析.doc
- 2025届广西贺州中学高考冲刺押题(最后一卷)生物试卷含解析.doc
- 安徽省池州市贵池区2025届高三第一次模拟考试生物试卷含解析.doc
- 宁夏银川一中2025届高三(最后冲刺)化学试卷含解析.doc
- 广东省广州市增城区四校联考2025届高考压轴卷化学试卷含解析.doc
- 2025届邯郸市第一中学高考生物必刷试卷含解析.doc
- 2025届安徽省安庆市石化第一中学高考仿真卷化学试卷含解析.doc
文档评论(0)