I have lots of objects that are very similar, and I have one particular method that does the same work on each object, so I created a base class. The thing is, one particular object, in one particular method, needs to have a tiny bit of massaging before the standard work is done.
But I keep getting parse error "call to undefined function". But it is there. I called it earlier in the script outside of the base class.
Here's what I've tried to do, simplified:
I create a base class which, among other things, has a get_val method, which does a lot of stuff. It's the same kind of work for a range of objects.
One particular class needs extra work done in certain cicumstances, so at the beginning of this base class routine, I make a call to a method defined in the child class.
// Base class
class baseobj()
{
[...]
function get_val($field)
{
$this->_val_prep($field); // does object prep manpulation, defined in child class;
[ lots o' work ]
return $value;
}
}
//Child class
class childobj extends baseobj
{
[...]
function _val_prep($field)
{
if ([work needed test expr])
{
[prep work]
}
}
}
The problem is that this fails to parse. I get a:
Call to undefined function: _val_prep() error.
But the function is clearly there. I can access the method so long I don't descend into the base class. Once there, for some reason, it can't see methods defined in the child class.
If I define the method in the base class, it parses and executes that method. But shouldn't that be overidden if the same-named method exists in the child class?
Am I doing something wrong? Had this been seen before?
Thanks for any help.