法则4:Liskov替换法则(LSP) % r# M9 r8 g& h: ^2 t1 {, L/ f a7 D/ ~7 x A; [$ N, E
+ O4 b, U& ?+ p
使用指向基类(超类)的引用的函数,必须能够在不知道具体派生类(子类)对象类型的情况下使用它们。 0 H7 _& d& I$ E8 ~ ( g: N- n1 \$ o! @$ j7 ?) i' m5 j, m. m/ u
[ Function Thar Use Referennces To Base(Super) Classes Must Be Able To Use Objects Of Derived(Sub) Classes Without Knowing It ] 2 \3 w) q$ s3 l& U6 E T4 Q7 ]0 X% a7 k0 Z/ Q8 }, y/ M5 H
; c5 ]" l! S) B( |2 J& s7 i) X3 D
Liskov替换法则 # D! C; o6 H% K/ B' U) b" @, h
+ v0 o; m% m* C. u* `6 l