4 ms·
In OOP, isn't that essentially just overloading? In many OO languages, you could write both of those lines as-is (with corresponding method bodies) and have va
by zenexer 8y ago
In OOP, isn't that essentially just overloading? In many OO languages, you could write both of those lines as-is (with corresponding method bodies) and have valid code. They'll typically be treated as two separate methods that just happen to have the same name.
- oweiler 8y agoThe main difference is that overloading is resolved at compilation time whereas multi methods are resolved at runtime.
- pjmlp 8y agoNo because multi-mthods don't have a self/this pointer as such, rather they are dispatched at runtime taking into account the actual types of each parameter.
- skocznymroczny 8y agoIn OOP, I think the closest equivalent would be the visitor pattern.