Re:Ask HN: Concepts that clicked only years after you first ...
by jacobsimon on Sunday January 01, 2023 @11:09AM
(#34207451)
I think you might have it backwards. The first example _is_ dependency injection, too, since you are passing the required instances into the constructor. The non-DI approach would be for the Car class to import and instantiate the Wheels class inside its constructor function.
[ Parent
| on HN ]
There are no comments on this comment yet.