PHP OOP variable scope problem
|
12-28-2010, 08:10 AM,
|
|||
|
|||
PHP OOP variable scope problem
Aight', I've never dug deep into the php OOP thing, as I've always relied on procedural programming or OOP on a very low level...bla...bla...
Silly me, ANYWAY, I've run into a problem, I just can't solve. I donno' whether I should use $this, parent, self, :: (Scope resolution operator). Or whether the static keywords is even supposed to be there. The case is, that I have a main class, in which I've instantialized(?) two secondary classes (Main -> One and Main -> Two). Afterwards, through the main class I've changed instance Two's variable $Xenon to be " in ". But I keep getting an: Code: Trying to get property of non-object Don't mind the resulting sentence, it's just random stuff Main.php PHP Code: class Main child.php PHP Code: class First extends Main child2.php PHP Code: class Second extends Main I've found out, that I can get the result I want if I pinpoint the $Xenon variable from an absolute/global perspective, like this: PHP Code: function Activate($Arg) Regards and thanks in advance - Vanilla |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
PHP OOP variable scope problem - by Vanilla - 12-28-2010, 08:10 AM
RE: PHP OOP variable scope problem - by RichardGv - 12-28-2010, 04:12 PM
RE: PHP OOP variable scope problem - by Vanilla - 12-29-2010, 12:59 AM
RE: PHP OOP variable scope problem - by RichardGv - 12-29-2010, 11:26 AM
RE: PHP OOP variable scope problem - by Vanilla - 12-30-2010, 02:20 AM
RE: PHP OOP variable scope problem - by Vanilla - 01-03-2011, 09:09 AM
|