How can a protected variable be accessed from a child Class if it has a different value?
Example to wrong access: parent::$_my gives error
class Father{
protected $_my=array('a','b');
}
class Child{
protected $_my=array('c','d');
function __construct(){
parent::__construct();
$this->_my=array_merge(parent::$_my,$this->_my);
}
}
Thanks,
Yosef
$this->_mywill be inherited from the parent when you instantiate a subclass, so you simply need to use: