Alice extends class C with class A, which implements function a.
Bob extends class C with class B, which implements function b.
I have both Alice’s and Bob’s code, and I want to use both a and b. How can I do it?
Of course, there are ways to do it – notably multiple inheritance, if your language supports it – but the point is, in a functional language, this question never even arises. You just import the function definitions and use them, without ever having to think about the mechanics of it.
By the way, I’m not saying that this necessarily makes functional languages better (although I do tend to prefer them). I’m just pointing out that the difference is real.
Yes, but in common discussion, noone when talking about OOP is referring to inheritence-less OOP. No common programming language uses it, few to no programmers practice it. OOP/w inheritance is the default item being discussed.
As neither of you, I'm talking about OOP. Nobody's limiting the discussion to composition or inheritance. Otherwise we'd be talking about how 'inheritance sucks' rather than 'OOP sucks'.
If class A and B wrap a C by composition and expose, respectively, `a` and `b`, then I still very much have the choice of which I'm building. Perhaps less so if they wrap a C by reference, so the C can be reused (it's too late at night to be sure I've thought it all the way through).
http://wiki.c2.com/?ExpressionProblem