古詩詞大全網 - 古詩大全 - protected和private區別

protected和private區別

二者的區別主要在權限問題上,protected 是受保護的,只有當前類的成員與繼承該類的類才能訪問;private是完全私有的,有當前類中的成員能訪問到。 擴展資料

 1、protected

 adj. 受保護的。動詞protect的過去式和過去分詞形式。

 句子示例:

 It's against the law to kill protected animal.

 屠殺被保護動物是違法的。

 As the protected infant industries grow, their costs sometimes fail to decline.

 當受保護的新興工業增長時,有時成本無法降低。

 2、private

 adj. 私人的;個人的;私下的;私有的;緘默的';為壹部份人的;內心的;與工作無關的。

 n. 士兵;列兵。

 句子示例:

 She is a very retiring and private person.

 她是個非常孤獨緘默的人。

 We each have our private views about it.

 我們每個人對這件事都有自己的看法。