thinking in java 读书笔记

本文探讨了在面向对象编程中复用已有类的两种主要方法:直接使用该类的对象和通过组合创建新类。解释了如何利用现有类的功能来构建更复杂的应用程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

记录下来,以便以后查看
thinking in java 4th
chapter one
resuing the implementation
[b]The simplest way to reuse a class is to just use an object of that class directly, but you can also place an object of that class inside a new class. We call this “creating a member object.” Your new class can be made up of any number and type of other objects, in any combination that you need to achieve the functionality desired in your new class. Because you are composing a new class from existing classes, this concept is called [color=red]composition[/color] (if the composition happens dynamically, it’s usually called [color=red]aggregation[/color]). Composition is often referred to as a “has-a” relationship, as in “A car has an engine.”[/b]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值