2 ms·
It's all Turing complete, so of course you can implement the same thing as protected methods by using callbacks. When I say power here I don't mean in the sense
by mike_hearn 3y ago
It's all Turing complete, so of course you can implement the same thing as protected methods by using callbacks. When I say power here I don't mean in the sense that you literally can't do it any other way, I mean it's more convenient and natural.
C++/Java/Kotlin style OOP is basically about putting common design patterns into language syntax. You could do it all with C, but it's easier if the compiler does it for you. For example Kotlin has "data classes" and Java now has "records" which are in both cases classes, but they sacrifice inheritance in order to auto-generate more boilerplate for you. That's still OOP though.