On Mon, 2002-02-18 at 12:12, Richard Fox wrote: > That's right, the difference between C++ "pure virtual" and "virtual" is > that a virtual function has an implementation but pure virtual only defines > an interface. > > But can we get back to my original PHP question: Can I do something like the > following in php:
What happened when you tried it? I got 'BaseDerived1Derived2' on 4.2.0. Torben > class Base { > function Foo() { echo "Base"; } > } > > class Derived1 extends Base { > function Foo() { echo "Derived1"; } > } > > class Derived2 extends Base { > function Foo() { echo "Derived2"; } > } > > function Example ( $objvar ) { > $objvar->Foo(); > } > > ... > > $obj1 = new Base(); > $obj2 = new Derived1(); > $obj3 = new Derived2(); > Example($obj1); > Example($obj2); > Example($obj3); > > I think what I am asking is, is there any concept of a virtual function in > PHP, with a virtual function table? > > Rich > > > -----Original Message----- > From: Martin Towell [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 17, 2002 5:31 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Polymorphism question > > > A bit late in replying - but what the hay (or is that "hey"??) oh well... > > >From my understanding of virtual functions (and it's been at least 3 to 4 > years since I've done C++) is that a "virtual function" has basic > functionality and a "pure virtual function" has no, and can't have, and > code. > > Please correct me if I'm wrong > > Martin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php