PHP PHP Setter and Getter Oct 27, 2019 Setter and Getter 12345678910111213141516171819202122Class T {public $A;protected $B;private $C;public function setA(){ $this->A = A;}protected function setB(){}public function getA(){ $this->A = A;}protected function getB(){}} 應用在讓程式可視性更高,不直接在變數定義,而是在setter去定義,再透過getter去拿取 function的部分 外部 繼承 public Yes Yes protected No Yes private No No