4 ms·
Even in video games, I avoid inheritance, I always much prefer composition. Build a complex object from many small objects, then vary behavior with parameters r
by jay_kyburz 11mo ago
Even in video games, I avoid inheritance, I always much prefer composition. Build a complex object from many small objects, then vary behavior with parameters rather than deriving a child class and overriding methods.
- TZubiri 11mo agoRight that's still OOP.
- jay_kyburz 11mo agoOh yeah, just saying inheritance is the part I don't like.
- 1718627440 11mo agoInheritance and composition is fundamentally the same. This is easy to see when you implement it in a language that has no specific support for either (like C). Inheritance is basically composition of the data and the vtable and then overriding the default vtable entry with the supertype implementation.