2 ms·
>why use OO at all if you prefer composition? OO is a way to bundle a structure with the methods to manage it. Inheritance is a way to manage the need to cust
by mikewarot 6y ago
>why use OO at all if you prefer composition?
OO is a way to bundle a structure with the methods to manage it.
Inheritance is a way to manage the need to customize an object.
Composition is a way to bundle objects.
Why wouldn't you do both? That's what Delphi did back in the 1990s when they built the Visual Component Library. (VCL)
You build your forms in the GUI builder, which composed a form object out of various components which were all eventually derived from tObject. It still lives on, and Lazarus implements something similar for Free Pascal.