Class problem
Posted: Thu Jul 29, 2010 7:02 pm
Hello all,
I have a problem with a class (X) I want to execute one class (Z) function foo() bust I get an "Fatal error: Using $this when not in object contex" when I call it, any idea what's wrong or if this is possible.
I'll appreciate your help.
Thank you
I have a problem with a class (X) I want to execute one class (Z) function foo() bust I get an "Fatal error: Using $this when not in object contex" when I call it, any idea what's wrong or if this is possible.
I'll appreciate your help.
Thank you
Code: Select all
class Z {
function foo() {
// do somethig
}
}
class X {
$x
function __contruct() {
$this->x = new z();
}
function var() {
$this->x->foo(); // Fatal error: Using $this when not in object contex
}
}
// Class declaration here
class Y {
function __contruct() {
$z = new z();
$x = new x();
}
}