示例#1
0
        return $this->prop1 . "<br/>";
    }
}
class MyOtherClass extends MyClass
{
    public function __construct()
    {
        parent::__construct();
        echo "the class " . __CLASS__ . " was started  --- contructor extended" . "<br/>";
    }
    public function newMethod()
    {
        echo "From a new method in " . __CLASS__ . ".<br />";
    }
}
$newobj = new MyOtherClass();
$newobj->newMethod();
echo $newobj->prop1;
echo $newobj->getproperty();
/*
$obj=new MyClass;
//var_dump($obj);

echo $obj; // __tostring is called
echo $obj->getproperty();

$obj->setproperty("I'm a new property value!");

echo $obj->getproperty();
unset($obj);// destruct is call
*/