Devin Mullins <twifkak / comcast.net> wrote: > BTW, I started reading some of the LSP thread on the c2 wiki that > somebody else linked to. Pretty interesting. It seems several of them > want to draw a distinction between subclass and subtype -- they find > that there are times they want to subclassing but not follow LSP. I > think they're using a language that doesn't have mixins, Forwardable, > etc. so subclassing is the only way for them to share code between > classes. :) Not necessarily so: Bertrand Meyer (inventor of Eiffel) has a very broad understanding of inheritance. His position is that inheritance may serve serveral ends, subtyping being only one of them. For him implementation inheritance is as justified as inheriting along "is a" relationships (leading to subclasses being subtypes). In Eiffel you can inherit from a class and make some or all methods private that were public in the superclass. This is a classic example where the subclass is not a subtype. Personally I do not like this approach but his position has some arguments in favour of it. For example you can provide classes that implement some concepts and inherit privately from them so you can easily use the implementation but do not need to support the public interface of that class. This can be a quite elegant way that avoids the quirks of delegation that one often has to use instead. But the notion of subtype is not restricted to object oriented languages. You can have non oo languages where a type A's interface and functionality is a superset of a type B's interface and functionality and you can indeed use B where A is expected. Functional programming languages come to mind, for example ML. The bottom line: "subtype" and "subclass" are orthogonal concepts; subclassing can be used to create sub types (and often this is done) but it need not to and vice versa you can have subtypes that are not subclasses. Kind regards robert Some links: http://en.wikipedia.org/wiki/Subtype http://en.wikipedia.org/wiki/Subclass_%28computer_science%29 http://en.wikipedia.org/wiki/Eiffel_programming_language http://en.wikipedia.org/wiki/ML_programming_language