You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
692 B
11 lines
692 B
Al使用情况
|
|
•借助AI完成抽象类设计、子类继承实现、
|
|
工具类封装的代码框架
|
|
·排查并解决了「类名与文件名不一致」「构
|
|
造方法名错误」等编译问题
|
|
|
|
维度 继承(Inheritance) 组合(Composition)
|
|
关系本质 关系(子类是父类的一种) 关系(整体包含部分)
|
|
耦合度 高,子类依赖父类实现,修改父类易影响子类 低,通过接口交互,修改内部实现不影响外部
|
|
复用性 代码复用,但受限于单继承 更高,可灵活组合多个对象
|
|
适用场景 类间存在明确的「种类」关系(如 Circle is a Shape) 类间存在「包含」关系(如 Car has a Engine)
|
|
|