Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class class_one {
  2.  
  3. protected $value;
  4. private $obj_two;
  5.  
  6. public function __construct() {
  7. $this->obj_two = new class_two;
  8. }
  9.  
  10. public function firstFunction() {
  11.  
  12. $this->obj_two->obj_two_function();
  13.  
  14. echo $this->value; // returns 'New Value' like set in the class two
  15.  
  16. }
  17.  
  18. }
  19.  
  20. class class_two extends one {
  21. public function obj_two_function() {
  22. "class_one"->value = 'New Value';
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement