3 ms·
It is not unrelated. If a is an abstract class, and f takes a pointer to an a, I can pass it a b, for any b which inherits from a; the implementation of b is u
by moonchild 4y ago
It is not unrelated. If a is an abstract class, and f takes a pointer to an a, I can pass it a b, for any b which inherits from a; the implementation of b is up to me.
- c-cube 4y agoIn the context of generics/templates, it is unrelated. GP is right. C++ templates are duck typed, but with concepts they're now moving towards static contracts on parameters, like rust's trait bounds. No relation to inheritance or the notion of class.
- moonchild 4y agoIt is obviously different, but that does not mean that it is unrelated.