Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.
Hope you enjoy the instance!
Follow the wormhole through a path of communities !webdev@programming.dev
Take Rust as an example, composition implemented in modern languages is really a mix of both paradigms.
In the Advantages of Inheritance section, we can emulate the inheritance way by adding a
IndefinitelyDoStuff
type class (or interface). The type’s capability is extent by type class hierarchy and code duplication is mitigated by default implementation.Similarly, adding that to the type class declaration will enforce implementation for each instance to be added at compile time.