微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 我们称这是什么?

我想知道我们称这种作业是什么.
<?PHP
class SimpleClass
{
    public $var1;
    public $var2;
    public $var3;

    public function SimpleClass()
    {
        $this->var1 = 'one';
        $this->var2 = 'two';
        $this->var3 = 'three';
    }
}

function test()
{
    $objSc = new SimpleClass();
    $objSc->var4 = 'WTF?!'; # <-- what do we call this?
    var_dump($objSc);
}

test();
?>

更好的参考或链接.提前致谢!

编辑:我正在寻找一个技术术语,好吧,如果我们有.

我相信这是超载.

Overloading in PHP provides means to dynamically “create” properties and methods. These dynamic entities are processed via magic methods one can establish in a class for varIoUs action types.

The overloading methods are invoked when interacting with properties or methods that have not been declared or are not visible in the current scope.

PHP手册参考here.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐