热门问题
时间线
聊天
视角

里氏替換原則

来自维基百科,自由的百科全书

里氏替换原则
Remove ads
Remove ads

面向對象的程序設計中,里氏替換原則(Liskov Substitution principle)是對子類型的特別定義。它由芭芭拉·利斯科夫(Barbara Liskov)在1987年在一次會議上名為「數據的抽象與層次」的演說中首先提出。[1]

Thumb
里氏替換原則由芭芭拉·利斯科夫提出,照片攝於2010年.

里氏替換原則的內容可以描述為: 「派生類(子類)對象可以在程式中代替其基類(超類)對象。」 以上內容並非利斯科夫的原文,而是譯自羅伯特·馬丁(Robert Martin)對原文的解讀。其原文為:

Let be a property provable about objects of type . Then should be true for objects of type where is a subtype of .

芭芭拉·利斯科夫周以真(Jeannette Wing)在1994年發表論文並提出以上的Liskov代換原則

Remove ads

引用

Loading content...

參考文獻

Loading content...

參閲

外部連結

Loading content...
Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads