gpt4 book ai didi

java - 里氏代换原则——如何建模正方形和长方形

转载 作者:搜寻专家 更新时间:2023-10-31 08:21:18 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Is deriving square from rectangle a violation of Liskov's Substitution Principle?

通过应用 LSP,谁能给我一个 Square 和 Rectangle 的实现?

我看过《Head First Object-Oriented Analysis and Design》这本书,他们说如果 Sqaure 继承自 Rectangle,它违反了 LSP 但没有正确的实现。

有人想试试吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com