Should I access global db object directly from within the methods of each class? Or from each method, should I instantiate an instance of the db object?
One of my database objects changes depending on the id of the info being accessed so it is created through a function connectToDatabase(id). Should I make this a global function, have it return a database object and instantiate it from each method, or something else?
Thanks.