3 ms·
You're into structural versus nominal typing here, which is an important distinction (and tool) to point out.
by hinkley 7y ago
You're into structural versus nominal typing here, which is an important distinction (and tool) to point out.
- seemslegit 7y agoFirst, nominal is assumed because 'structural typing' was not a thing in any major language when the Liskov substitution principle was coined. Second, this is independent of structural vs nominal typing - implementation of an interface can be thought of as inheritance of a class whose methods all have noop implementations, and in fact this is (almost) how it's done in languages that don't have interfaces like C++