Reputation: 1002
I googled for this for quite awhile. I think I am missing some big concept, but I can't figure out why this won't work
//SomeClass.php
class SomeClass
{
protected $something;
public function __construct() {
$this->something = 'password';
}
public function test() {
return ($this->something);
}
}
//OtherClass.php
require_once('SomeClass.php');
class OtherClass extends SomeClass
{
public function __construct() {
echo parent::test();
}
}
What is the deal here?
Upvotes: 0
Views: 67
Reputation: 190
You should call parent::__construct() before calling parent::test()
Upvotes: 6