本文整理匯總了PHP中D::unsetPrivate方法的典型用法代碼示例。如果您正苦於以下問題:PHP D::unsetPrivate方法的具體用法?PHP D::unsetPrivate怎麽用?PHP D::unsetPrivate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類D
的用法示例。
在下文中一共展示了D::unsetPrivate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: D
$this->p = 'changed in D';
}
}
echo "Unset and recreate a superclass's private property:\n";
$d = new D();
$d->unsetPrivate();
$d->setPrivate();
var_dump($d);
echo "\nUnset superclass's private property, and recreate it as public in subclass:\n";
$d = new D();
$d->unsetPrivate();
$d->setP();
var_dump($d);
echo "\nUnset superclass's private property, and recreate it as public at global scope:\n";
$d = new D();
$d->unsetPrivate();
$d->p = 'this will create a public property';
var_dump($d);
echo "\n\nUnset and recreate a private property:\n";
$c = new C();
$c->unsetPrivate();
$c->setPrivate();
var_dump($c);
echo "\nUnset a private property, and attempt to recreate at global scope (expecting failure):\n";
$c = new C();
$c->unsetPrivate();
$c->p = 'this will fail';
var_dump($c);
?>
==Done==
--EXPECTF--