| 
<?php
require "classPrototype.php";
 
 class test extends classPrototype
 {
 var $a=2;
 
 var $b=3;
 
 function _construct(){
 parent::_construct();
 }
 }
 
 $test=new test();
 $test->prototype->a=4;
 
 $test2=new test();
 $test->prototype->c=4;
 
 echo $test->a; //A on $test is 2 because it was assigned before the changing of the prototype
 echo $test2->a; //A on $test2 is 4 because the object has been initialized after the changing of the prototype
 
 echo $test->b;
 echo $test2->b; //B is 3 on both objects because it hasn't been changed
 
 echo $test->c;
 echo $test2->c; //C is 4 on both objects because it wasn't defined before the assignment on the prototype so every instance has taken it
 ?>
 |