How does Truck module have DataSource methods?

Can someone explain to me how the Truck module has access to the DataSource methods?

Gonna answer my own question in case its helpful to anyone. Having re-read the chapter, its because the Truck constructor takes two parameters, truckID and db. The db parameter being an instance of Datasource thus having access to its methods.

:thumbsup: @JSLearner

This pattern has become really popular across languages; you’ll often hear it loosely referred to as Dependency Injection.