test.php
class AClass {
public function __construct()
{
echo '<strong style="color:blue;">AClass construct</strong><br>';
}
public function call()
{
$this->koko();
}
private function koko()
{
echo 'koko <br>';
}
}
class BClass extends AClass {
public function __construct()
{
echo '<strong style="color:red;">BClass construct</strong><br>';
parent::__construct();
}
public function momo()
{
echo 'momo <br>';
}
}
$xxx = new AClass(); // Output: AClass contruct ..... (where is BClass echo ?)
$xxx->call(); // Output: koko
$xxx->momo(); // Output: Fatal error: Call to undefined method AClass:momo()
Maybe newbe question but.... What is wrong ?
$xxx
is an instance of AClass. Thus, the method doesn't exist.