I guess I have a problem understanding inheritance.
I have 4 classes like so;
class FOO extends WP_Widget {
protected $pluginOptions;
function __construct() {
$this->pluginOptions = get_option('option_name',0);
/*$this->pluginOptions['email'] returns /is set to [email protected] here*/
}
}
class FOO_ACTIONS extends FOO {
function __construct() {
parent::__construct();
/*some actions*/
}
/*some methods*/
}
class FOO_SEND_EMAIL extends FOO_ACTIONS {
function __construct() {
parent::__construct();
/*some actions*/
}
/*some methods*/
}
class BAR extends FOO{
function __construct() {
/*change email here */
$this->pluginOptions['email']='[email protected]';
}
}
$BAR=new BAR();
in another file i am calling:
$sendEmail=new FOO_SEND_EMAIL;
I thought that - as BAR
gets called before FOO_SEND_EMAIL
$this->pluginOptions['email']
is now [email protected]
.
However, when doing $sendEmail
it is still set to [email protected]
. can anyone point me in the right direction perhaps as to where I'm going wrong here? (happy to provide more code of course if necessary).