加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 我们称这是什么?

发布时间:2020-12-13 16:30:26 所属栏目:PHP教程 来源:网络整理
导读:我想知道我们称这种作业是什么. ?phpclass SimpleClass{ public $var1; public $var2; public $var3; public function SimpleClass() { $this-var1 = 'one'; $this-var2 = 'two'; $this-var3 = 'three'; }}function test(){ $objSc = new SimpleClass(); $ob
我想知道我们称这种作业是什么.
<?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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读