[nycphp-talk] class method name exists, class property exists, calling method fails
soazine at pop.erols.com
soazine at pop.erols.com
Mon Oct 27 14:35:32 EST 2003
I have a class object I am calling in another class:
class Stuff {
var $myObj;
function Stuff($myObj) {
$this->myObj = $myObj;
}
function doStuff() {
print_r(get_class_methods($this->myObj)); print_r("<P>");
print_r($this->myObj->name . "<P>");
print_r($this->myObj->getName() . "<P>");
}
}
The first "print_r" works just fine and shows a "getName" method in the
array of methods for object $this->myObj. The second "print_r" works just
fine and shows the property value that was set in a prior
$whateverObjName->setName('Whatever'); the value comes up as "Whatever".
BUT the third print_r throws a nasty error "Member function called on a
non-object". What happened? How did it turn from being a legitimate object
to a NON-object in one line? Could someone with some class experience
point me in the right direction as far as using "getter" functions of one
object inside another object function? Confused.
Thanx
Phil
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
More information about the talk
mailing list