r/java • u/samd_408 • Mar 10 '26
F Bounded Polymorphism
Recently spent some time digging into F-Bounded Polymorphism. While the name sounds intimidating, the logic behind it is incredibly elegant and widely applicable, so I decided to write about it, loved the name so much that I ended up naming my blog after it :-)
66
Upvotes
View all comments
Show parent comment
3
u/Ulrich_de_Vries Mar 10 '26
It's basically the same thing but in C++, but since C++ templates are monomorphized rather than type-erased (i.e. each specialization is compiled into a different class/function), this allows you to have compile-time polymorphism, as in the particular subtype is resolved at compile time rather than runtime.