热门问题
时间线
聊天
视角
里氏替換原則
来自维基百科,自由的百科全书
Remove ads
Remove ads
在面向對象的程序設計中,里氏替換原則(Liskov Substitution principle)是對子類型的特別定義。它由芭芭拉·利斯科夫(Barbara Liskov)在1987年在一次會議上名為「數據的抽象與層次」的演說中首先提出。[1]

里氏替換原則的內容可以描述為: 「派生類(子類)對象可以在程式中代替其基類(超類)對象。」 以上內容並非利斯科夫的原文,而是譯自羅伯特·馬丁(Robert Martin)對原文的解讀。其原文為:
- Let be a property provable about objects of type . Then should be true for objects of type where is a subtype of .
Remove ads
引用
參考文獻
參閲
外部連結
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads