Objects inside of objects help.
Posted: Tue Apr 20, 2010 2:55 am
Hey everyone. I have been using php for a while and taught myself how to used it. My original language was C/C++ so sometimes I try to pull things in from that that just do not work. Anyway here is the problem I am not able to figure out. I have an object that handles all of my database logic for me but I am not able to create that object inside of another object (kind of like a self created variable) Does PHP not support this or is there a work around for this issue? Here is an example of what I am trying to do.
Currently my Data_Connection works perfectly the way I want it to as long as it is not inside of another class. But trying to put this into a 3 tier model is just not working for me right now. Please help. Thanks a lot
Code: Select all
class Data_Connection
{
//Some properties
//Some methods
}
class Sitelogic
{
private $Database_Connection = new Data_Connection;
}