Lisksov Substitution Principle

    內容表格
    沒有標頭

    版本為 23:42, 23 Nov 2024

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    LSP原則主要有兩種規格定義:

    1. If for each object to o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for  o2 then S is a subtype of T.
      如果對每一個型別為S的物件o1, 都有型別為T的物件o2, 使得以T定義的所有程式p在所有的物件o1都替換成o2時, 程式P的行為沒有發生變化, 那麼型別S就是行別T的子型別.
    2. Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.
      所有參照基礎類別的地方必須能透明地使用其衍生類別的物件.
    Powered by MindTouch Core