- Edited
the private function it doesn't work because is private and comes from the class B,and the protected function is not working the b->operation2() ;
I don't understand the ___construct() $this->operation();
class A {
private function operation1(){
echo "operation1 called";
echo "<br/>";
}
protected function operation2(){
echo "operation2 called";
echo "<br/>";
}
public function operation3(){
echo "operation3 called";
echo "<br/>";
}
}
class B extends A {
function __construct(){
/*$this->operation1();*/
$this->operation2();
$this->operation3();
}
}
$b = new B;
/*$this->operation1();*/
/*$b->operation2();*/
$b->operation3();
they return function operation2 and 3 and $b->operation3();