Liskov substitution principle (里氏替换原则)

In object-oriented programming, the Liskov substitution principle is a particular definition of subtype that was introduced by Barbara Liskov in a 1987 conference keynote address entitled Data abstraction and hierarchy.

Liskov formulated the principle succinctly in a subsequent paper as follows:

Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.

Thus, Liskov's notion of "subtype" defines the notion of substitutability; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program (e.g., correctness).

http://en.wikipedia.org/wiki/Liskov_substitution_principle

你可能感兴趣的:(BST)