4 ms·
I don't think Rust has anything comparable to implementation inheritance like C++ has? Getting implementation inheritance from pure composition is essentially
by zozbot123 8y ago
I don't think Rust has anything comparable to implementation inheritance like C++ has? Getting implementation inheritance from pure composition is essentially a "tying the knot" exercise, where you must ensure that "virtual" method calls are always dispatched on through something like an existential type, so that they can reach the right implementation for the actual "child" object. (The right question to ask is "when do we actually need this, ffs?" Almost never, as it turns out - it's just needless complexity. Hence, "prefer composition over inheritance!")