I have another question about OO in PHP --
The manual (http://www.php.net/manual/en/language.oop.constructor.php)
does an excellent job of explaining how constructors in extended classes
work when there are constructors in base classes. I understand that no
problem. But at the bottom of the page is a cautionary note:
Neither PHP 3 nor PHP 4 call constructors of the base class
automatically from a constructor of a derived class. It is your
responsibility to propagate the call to constructors upstream where
This is where I am uncertain -- how do I call an upstream constructor
from an instance of an extended class, where I have a constructor in the
extended class? IOW:
print "ClassA object instantiated, argument is $var";
print "ClassB object instantiated, argument is $var";
$instance = new ClassB(frank);
// this should print "ClassB object instantiated, argument is frank"
My question is, how do I call the constructor of ClassA? To see the
// "ClassB object instantiated, argument is frank"
// "ClassA object instantiated, argument is bob"
Web Developer Temp
Media Lab, H.H. Brown
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php