|
|
|
|
|
by dgcoffman
4461 days ago
|
|
Okay, but that kind of polymorphism is actually a replacement for conditional logic, e.g. switch on type antipattern. People hate conditionals. People hate polymorphism. Everybody is wrong about everything pretty much all of the time, it appears. |
|
For example:
a and b do not share a common class (since classes do not exist in JavaScript), but they implement the same interface. For this reason, they can be used polymorphically, as if they shared a common base class or interface in Java or C++.