I have two classes, one inherits (extends) the other class.
Code: Select all
class A {
public function __construct {
$this->do_this();
$this->do_that();
}
protected function do_this() {
...
}
protected function do_that() {
...
}
}Code: Select all
if(!class_exists('A')) {
require_once('A.class.php');
}
class B extends A {
public function __construct() {
$this->do_those();
$this->do_this();
$this->do_that();
}
private function do_those() {
...
}
}
$trial = new B();[text]Fatal error: Call to private method A::do_this() from context 'B' in C:\xampp\htdocs\B.class.php on line 12[/text]
Protected methods are available to subclasses, right?