[ create a new paste ] login | about

Link: http://codepad.org/coCibwyk    [ raw code | output | fork ]

PHP, pasted on Apr 25:
<?php
class Test
{
    protected $ob = null;
    public function __construct( $ob )
    {
        $this->ob = $ob;
    }
    public function get() 
    {
        var_dump( $this->ob->data );
    }
    public function set( $val )
    {
        $this->ob->data = $val;
    }
}

$object = new stdClass;
$foo = new Test($object);
$bar = new Test($object);

$foo->set('lorem ipsum');
$bar->get();
?>


Output:
1
string(11) "lorem ipsum"


Create a new paste based on this one


Comments: