クラス階層を設計する際、サブタイプがスーパタイプの役割を損なうことなく置換可能であるべきという原則(リスコフの置換原則)を守れば、クライアントコードでサブクラスがスーパークラスの代わりに使われたときの予期しない動作を防げます。
復習用の問題
When designing class hierarchies, adhering to the Liskov substitution principle prevents unexpected behavior when a subclass replaces its superclass in client code.
When designing class hierarchies, adhering to the Liskov substitution principle prevents unexpected behavior when a subclass replaces its superclass in client code.
関連する単語
Liskov substitution principle
(object-oriented programming) A principle stating that any type having a subtype should be replaceable by its subtype without altering any of the desirable properties (such as correctness, task performed, etc.) of the program.
オブジェクト指向プログラミングにおける原則のひとつで、サブタイプはその基本となる型と置き換えてもプログラムの正しさや実行されるタスクなどの望ましい特性に影響を与えてはならないとする考え方。
- 項目の編集権限を持つユーザー - すべてのユーザー
- 項目の新規作成を審査する
- 項目の編集を審査する
- 項目の削除を審査する
- 重複の恐れのある項目名の追加を審査する
- 項目名の変更を審査する
- 審査に対する投票権限を持つユーザー - 編集者
- 決定に必要な投票数 - 1
- 例文の編集権限を持つユーザー - すべてのユーザー
- 例文の削除を審査する
- 審査に対する投票権限を持つユーザー - 編集者
- 決定に必要な投票数 - 1
- 問題の編集権限を持つユーザー - すべてのユーザー
- 審査に対する投票権限を持つユーザー - 編集者
- 決定に必要な投票数 - 1
