I'm used to c++ classes, where I created classes describing some behavior like : clickable, physical, visible, etc, etc. It's quite usual for me to inherit from multiple classes.
Godot don't let you inherit from multiple classes and I wonder how am I supposed to write logical, re-usable code than? I really don't want to create separate "clickable" object inside my button object because... It's weird... at least to me. Composition doesn't always fit into what we do. My object doesn't "has" clickable. It "is" clickable, so I want to inherit that. I would have to connect artificial "clickable" object to my object that is actually clickable, which seems like a lot of code that I need in one file and that I wanted to avoid in first place by... just inheriting from clickable and overriding some functions like onClick, onRelease, etc. On the other hand I could just inherit from clickable, but I cannot inherit from multiple classes than, so what if I will want to move some other property that I found might be useful to re-use in future - I will not be able too, because this new property either will HAVE TO inherit form clickable, or clickable will HAVE TO inherit from that new property.
After writing that I came to realisation that it's just inherently flawed design... Use composition only if you don't like inheritance. That would be more appropriate, because inheriting form canvasItem properties such as modulate or light-mask doesn't make any sense for Position2D or Camera2D. I think having access to unused properties is sign of bad design.
There is literally no point in using inheritance if you can only inherit from one class. The point is : sooner (or even sooner) you will have to add second property and than inheriting first property will be in-appropriate, as you want to treat both properties equally - the same way, so you should move from inheriting to "containing" those and wrapping a lot of code to access "contained" object.
My thesis is : single inheritance rule is flawed. Use either : (multiple inheritance) / (none at all) / (irrational code - sometimes you inherit properties, sometimes you contain them). I invite you to the discussion if you think it's wrong.
- My examples may not be ideal, but I strongly believe there would be better ones proving my point.
** That's all not to be said I won't use Godot, still I very much like it for other things. I just came to conclusion that single inheritance is super flawed and wanted to share my thoughts.