第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

在線等!php中繼承Static與延遲綁定十分感謝

在線等!php中繼承Static與延遲綁定十分感謝

達(dá)令說 2019-10-25 22:51:48
題目描述題目來源及自己的思路輸出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
查看完整描述

2 回答

?
白衣染霜花

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊

因?yàn)楸桓采w了啊staticchild沒有$parent_only,所以staticchild::$parent_only調(diào)用的是staticparent的$parent_only而staticparent的$parent_only被設(shè)置了fromchild所以打印出了fromchild
另外靜態(tài)綁定不是這么用的。
子類繼承父類覆蓋了a屬性。當(dāng)子類的一個(gè)實(shí)例對(duì)象調(diào)用父類一個(gè)獲取或使用a屬性方法時(shí),一般情況下,使用的是父類的a屬性。而靜態(tài)綁定,則使用的是子類自身的a屬性。概況起來就是誰的對(duì)象用誰的
                            
查看完整回答
反對(duì) 回復(fù) 2019-10-25
?
侃侃無極

TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊

本來寫了一些,但是感覺我自己都要被轉(zhuǎn)暈了,可以參考這篇文章。
(PHP)Latestaticbindingandchildattributedeclaration-Blog-(BKcore)ThibautDespoulain
                            
查看完整回答
反對(duì) 回復(fù) 2019-10-25
  • 2 回答
  • 0 關(guān)注
  • 334 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)