View Single Post
Old 02-04-2009, 11:53 AM   #5 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Yes you can, but I would not advise it.
Sometimes the classes you want to include(for example a DB class), you need to set that class up with some basic values, in this example(the db class) you need to connect and select a db before you can use it. And if you have it instanciated in the __construct, you need to pass all the DB values to that class.

Not to mention, it will be harder for you to use it in another class.
It's easier to pass it as a reference, because then you can set it up before you pass it, plus you can pass it to several different classes.

I'm not saying that my solution is the best in your case, but generally, you want to do how I said. Not good to learn bad habbits, they're so hard to get rid of.
__________________
Tanax is offline  
Reply With Quote