【发布时间】:2014-05-01 03:56:21
【问题描述】:
是否可以在 PHP 中“覆盖”objects 方法?示例:
<?php
class Test {
function Foobar() {
echo "Foobar";
}
}
$t = new Test();
// Replace the Foobar-method with new code
$t->Foobar() = function() {
echo "New Code";
};
?>
【问题讨论】:
标签: php class oop object overriding