I think this organisation will be one of the big players of the future in the PHP world. 我認為,這個組織將在PHP世界的未來的大牌球員之一。”
達倫

能見度

在一個類的所有函數和變量的定義,無論是公眾,保護或私人。

公眾

公共交通工具,內部和外部的類是可見的變量或函數。
PublicClass PublicClass
{
A public variable / /公共變量
name ; $的名稱;

A public function / /公共職能
SetName ( $ name )公共職能setName(名稱
{
this - > name = $ name ; - >名稱= $名稱;
}
}

保護

保護意味著當前類和類繼承這個類的變量或函數是可見的。
ProtectedClass ProtectedClass
{
A protected variable / /受保護的變量
name ;保護美元的名字;

A protected function / /一個保護功能
SetName ( $ name )保護功能setName( 姓名
{
this - > name = $ name ; - >名稱= $名稱;
}
}

SubClass : ProtectedClass 子類:ProtectedClass
{
__construct ( ) 功能 __建構()
{
I can change the value of the protected variable . / /我可以改變受保護的變量的值
this - > name = ' New class ' ; - >名稱='一類新的';
}
}

私人

私人手段,變量或函數只能在當前類中可見。
PrivateClass PrivateClass
{
A private variable , this cannot be seen outside the class . / /私有變量這不能被看作的外部
name ;私營$名稱;

A private function / /私有函數
SetName ( $ name )私有函數setName( 姓名
{
this - > name = $ name ; - >名稱= $名稱;
}
}

已提供任何意見。
安全形象
書面由多米尼克·斯金納
最後更新:2011年10月25日十六點00分38秒