3 ms·
This is not quite correct, at least not in most commonly-used languages. The difference comes when a "superclass" method calls self.whatever(), and the whateve
by nycticorax 2y ago
This is not quite correct, at least not in most commonly-used languages. The difference comes when a "superclass" method calls self.whatever(), and the whatever() is implemented in both the "superclass" and the "subclass". In the implementation-inheritance-based version, self.whatever() will call the subclass method. In the composition-based version, self.whatever() will call the superclass method. The implementation-inheritance-based version is sometimes called "open recursion". This is why you need implementation inheritance for the GoF Template pattern. See for instance this paper:
https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=d987a836d6ebf044d245349c765afc621e7be9e4 https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&d...