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:

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 ) {


$obj1 = new Base();
$obj2 = new Derived1();
$obj3 = new Derived2();

I think what I am asking is, is there any concept of a virtual function in
PHP, with a virtual function table?


-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 17, 2002 5:31 PM
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

Please correct me if I'm wrong


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to