I am new to PHP but 10 years in C++

One of the cool/powerful things you can do in C++ is the following:

class DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws a vanilla dialog box
   };

class DrawStyleDialog : public DrawPlainDialog {
public:
...
   virtual Draw(); // implementation draws better dialog
   };

Somewhere in my code I have a function like:

void ShowGUI( DrawPlainDialog& dd ) {
   dd.Draw();
   }

ShowGUI can be called with any object that is derived from DrawPlainDialog,
obviously. Only code that calls ShowGUI must be changed when a new
implementation of DrawPlainDialog is used. This feature of C++ to have a
base class pointer (or reference) be able to access derived class
functionality is not something I've seen in any PHP documentation. Does it
exist, and if not is there a workaround for this highly desirable feature?

TIA

Rich

PS Can anyone point me to the most comprehensive OOP documentation for PHP?

----------




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to