Page 1 of 1

parent:: and this->

Posted: Wed Jun 04, 2008 7:31 am
by shiznatix
I am doing some mixing up and slimming of files to make things easier to edit and keep track of. One problem I am having though is accessing some of the parents class properties. I was using this:

Code: Select all

$this->_request->getParam('variable');
but thats not going to be good for me anymore as I am using a subclass to do that work. I have tried:

Code: Select all

 
parent::_request->getParam('variable');//error unexpected T_OBJECT_OPERATOR
parent::_request::getParam('variable');//error unexpected T_PAAMAYIM_NEKUDOTAYIM
 
so how to I access a parent object variable properly in a child class?

Re: parent:: and this->

Posted: Wed Jun 04, 2008 7:36 am
by Kieran Huggins
Looks like a visibility issue... is it public static?

http://ca.php.net/manual/en/language.oo ... bility.php

Also, it looks fishy since it's neither a $variable, nor a function(). Is it a CONSTANT?

Re: parent:: and this->

Posted: Wed Jun 04, 2008 8:22 am
by shiznatix
Ya it was a visibility problem. I got a workaround going on so blah.