This is probably pretty simple but I haven't been able to figure out how to phrase the question for Google, so here goes:
So, I often do something like this...
class foo {
private $bar = array();
}
... to set some class property to be an array. However, I'd like to make a private property an object instead, something like this:
class foo {
private $bar = new stdClass();
}
I tried several variations of this and none of them worked. Can this be done? For bonus points can you assign a private property to be any other class of object?
Thanks!