題目描述題目來源及自己的思路輸出Parent:parent_only=fromchild,both_distinct=fromparentChild:parent_only=fromchild,both_distinct=fromchild,child_only=fromchildhttps://www.php.net/manual/zh...相關(guān)代碼//請(qǐng)把代碼文本粘貼到下方(請(qǐng)勿用圖片代替代碼)$a=newstaticparent;var_dump(get_class_vars("staticparent"));$a=newstaticchild;echo"";var_dump(get_class_vars("staticparent"));出現(xiàn)以下結(jié)果array(2){["parent_only"]=>string(10)"fromparent"["both_distinct"]=>string(10)"fromparent"}array(2){["parent_only"]=>string(9)"fromchild"["both_distinct"]=>string(10)"fromparent"}我想咨詢下,為什么newstaticchild后父類的parent_only會(huì)被修改,而both_distinct卻不會(huì).另外輸出的原因是什么,而且把注釋里面self::打開,替換static,結(jié)果為何是一致Parent:parent_only=fromchild,both_distinct=fromparentChild:parent_only=fromchild,both_distinct=fromchild,child_only=fromchild
在線等!php中繼承Static與延遲綁定十分感謝
達(dá)令說
2019-10-25 22:51:48