Jump to content

[SOLVED] class scope question


glenelkins

Recommended Posts

Hi

 

Bit lost on this one, say i have the following 3 classes:

 

class Test1 {

   var $test2;
   var $test3;

   var $test_string = 'HELLO WORLD';

   function Test1() {

       $this->test2 =& new Test2();
       $this->test3 =& new Test3;
  
    }

}

class Test2 {

   function Test2() {

        // want to echo $test_string from Test1()

   }

}

class Test3 {

}

 

How can i make it so the Test2 object can access the $test_string   from the Test1 class?? Or better explained still, i want to access the Test2 object from the Test3 class ??

Link to comment
https://forums.phpfreaks.com/topic/156106-solved-class-scope-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.