次のコードは1を出力しますが、なぜですか?プロパティはプライベートであり、子クラスはそれにアクセスできないようにする必要があります。
<?php
trait PropertiesTrait {
private $same = true;
}
class PropertiesExample {
use PropertiesTrait;
public function foo(){
echo $this->same;
}
}
(new PropertiesExample())->foo();
?>