Class/Objects

From: Date: Fri, 31 May 2002 16:02:19 +0000
Subject: Class/Objects
Groups: php.general 
Request: Send a blank email to php-general+get-100112@lists.php.net to get a copy of this message
Im still green with writing with class, but I just want to check with you all. I started creating a class file that also using 2 other classes. class.php ----------------------------------- <?php class foo {
    function foo()
    {
        require_once('./this.class.php');
        $this->db_obj = &new abc($db);
        require_once('./that.class.php');
        $this->tpl_obj = &new xwy;
    }
} ?> ---------------------------------- Then in my actual page I started this ---------------------------------- <?php require_once('./class.php'); $bar = new foo(); $bar->db_obj->run_some_code($bar); $bar->tpl_obj->do_this_for_me($bar); ?> ------------------------------------ It works but was wondering if its 'legal' to use it like this -> $lcre->db_obj->run_some_code($bar); $lcre->tpl_obj->do_this_for_me($bar); Im not extending the classes, just using them, so is what Im doing ok?? Thanks -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/

« previous php.general (#100112) next »