View Full Version : Need info on error

02-27-2012, 09:18 PM
This is the error;
Fatal error: Call to protected method _VIEW::getJs() from context '' in WC_new/new.php on line 8;
following is the code

//$_NEWOBJ = new _VIEW('new');
$_NEW = new _PIX_VIEWER('new'); // _PIX_VIEWER is a subclass of _VIEW
$_NEW_SRCSCRIPT = $_NEW->getJs(); // <<< line causing error
///$_NEW_SRCSCRIPT = $_NEWOBJ->getJs(); gives the same error

I don't under stand the meaning of 'context' in this context.
further info:
This code is in a file which is required by another file.
Original file -> requires this file;

I have tried to hunt this down in my reference material but have not
found a clue.
Thanks for time and attention

02-27-2012, 09:55 PM
protected methods can only be called within that class or any child classes.

class A
public $c;
protected function __construct($class)
$this->c = $class;

new A('A');

That will fail to construct object of instance A.
On the other hand:

class B extends A
public function __construct()

$a = new B();
print $a->c;

Will print 'B'.

02-27-2012, 10:16 PM
I think I know what the problem is.
Thank you for your time and attention;