View Single Post
Old 11-30-2007, 01:38 PM   #1 (permalink)
MartynMJ
The Wanderer
Newcomer 
 
Join Date: Nov 2007
Posts: 14
Thanks: 1
MartynMJ is on a distinguished road
Default Is referencing a class bad practice?

Just wondering is referencing a class in another class bad? Like so

PHP Code:
<?php

class test
{
   var 
$testing "";

   function 
blah()
   {
      return 
$this->testing;
   }
}

?>
And then in another file

PHP Code:
<?php

//include the file with the class above in

class two
{
   var 
$test "";

   function 
two ( &$test )
   {
      
$this->test $test;
   }

   function 
again ()
   {
      
$data $this->test->blah();
      return 
$data;
   }

}

?>
Hope that makes sense? :p
MartynMJ is offline  
Reply With Quote