4 ms·
This is not polymorphism. This is type coercion.
by astral303 9y ago
This is not polymorphism. This is type coercion.
- k__ 9y agoWhy not? you have a function that takes something that is polymorphic in the sense that I can be added. A string and a number aren't the same type, but they share some kind of interface.
- yorwba 9y agoType coercion is involved, but that's not mutually exclusive with polymorphism. Type coercion itself is a polymorphic operation, since it applies to parameters of multiple different types.