howto make a connection to database available in my classes.
What is the best practice when i want to write classes
that need a connection to the database?
Do i make a conn variable in my main() and give
it as a parameter to every object i make that needs
access to the database
ex.
A class called Price that need to do
some bussines logic to a database.
Price price = new price(param,param,connection)
or do i connect to the database in every class
i build
ex.
A class called Price that does a connection itself.
Price price = new price(param,param)
or any better practice?