Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Location
    Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
    Posts
    215
    Thanks
    52
    Thanked 1 Time in 1 Post

    Need info on error

    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
    Code:
    require_once('WC_php/pixViewerApp.php');
    //$_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
    JK

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    protected methods can only be called within that class or any child classes.
    PHP Code:
    class A
    {
        public 
    $c;
        protected function 
    __construct($class)
        {
            
    $this->$class;
        }
    }

    new 
    A('A'); 
    That will fail to construct object of instance A.
    On the other hand:
    PHP Code:
    class extends A
    {
        public function 
    __construct()
        {
            
    parent::__construct(__CLASS__);
        }
    }

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

  • #3
    Regular Coder
    Join Date
    Aug 2010
    Location
    Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
    Posts
    215
    Thanks
    52
    Thanked 1 Time in 1 Post

    O.k....

    I think I know what the problem is.
    Thank you for your time and attention;
    JK


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •