|
|
|
|
|
by marcosdumay
207 days ago
|
|
> You can reuse code without paying that price of inheritance. The same pinball of method calls happens at almost exactly the same way with composition. You save some idiosyncrasies around the meaning of the object pointer, and that's all. |
|
If Outer extends Inner, though, you can't tell whether `foo()` refers to Inner::foo or Outer::foo without checking to see whether Outer overrides foo or not. And the number of places you have to check scales linearly with the depth of the inheritance hierarchy.