Dear all,

    Attached are three files I used to demonstrate the problem I'm
troubled with. Some experiments may be required to see the problem.

    To put the problem in short, I'd like to ask what the proper way is to
include classA and classB in order to make test.php work? In the attached
file, I have included both class files in test.php and it works
properly. However, in real case, the caller of classB may not know the
relationship between classA and classB. So including classA from within
classB makes more sense. In that case, PHP throws Fatal Error: No parent
class available in this context., when running test.php.

    ClassB is extended from classA, and re-implements method A1 as a
wrapper function to method A1 found in its parent, classA. Use
$this->A1("ABC", "DEF") can get away from the fatal error, but runs into
core dump because it calls itself undefined number of times. So, let me
re-phrase my problem: Do I need to include all inheriting class files in
the caller program (like test.php) in order to make the construct of
re-implementing a wrapping function works?

    Thank you for reading this far. I wish I've explained my problem clear
enouth and someone can kindly pick it up from there. Thanks again.

Chien-pin

#!/usr/local/bin/php -q

<SCRIPT LANGUAGE="php">
include("./classA.class");
include("./classB.class");
$obj=new B;
$obj->A1();
</SCRIPT> 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to