Using PHP 4.3.3; I'm trying to write a class that has as a member an
instance of another class. Assume class B is already written and supports
the method "method()".
class A {
var _desc;
var _obj;
function A() {
$this->_desc = "Desc test";
$this->_obj = new B();
$this->_obj->method(); // Works here
}
function helper() {
$this->_obj->method(); // Parse error claiming that I'm calling a
member function on a non-object
return;
}
}
Is this not possible in PHP? Is there another way?
Help appreciated,
Derek
instance of another class. Assume class B is already written and supports
the method "method()".
class A {
var _desc;
var _obj;
function A() {
$this->_desc = "Desc test";
$this->_obj = new B();
$this->_obj->method(); // Works here
}
function helper() {
$this->_obj->method(); // Parse error claiming that I'm calling a
member function on a non-object
return;
}
}
Is this not possible in PHP? Is there another way?
Help appreciated,
Derek
Comment