The only way to do this is to use object prototypes like in languages such as Self, Lua, and JavaScript. Prototypes have not proven to be as effective as class-based OOP. That’s why they’re relatively obscure. Other than the three languages mentioned above, no other language of note is prototype-based.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store