is this an acceptable way of passing objects to other objects?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    is this an acceptable way of passing objects to other objects?

    I've read that objects should always be passed by reference to other
    objects. I've also read that future versions of PHP may not support
    runtime passing by reference (default passing by reference as
    parameters to a function), which is how I'm doing it right now. I'm
    wondering how any of you might otherwise handle this?

    Is something like the following compitable with good practice,
    assuming that $importantClass and $dbClass are two objects which exist
    before someClass is created?


    class someClass{

    var $importantClass ;
    var $dbClass;



    function someClass() {
    $this->importantCla ss = & $GLOBALS["importantClass "];
    $this->dbClass = & $GLOBALS["dbClass"];


    }
    }
Working...