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 DrawDialog {
public:
...
   virtual Draw(); // implementation draws a plain dialog box
   };

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

Somewhere in my code I have a function like:

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

ShowGUI can be called with any object that is derived from DrawDialog, obviously. Only 
code that calls ShowGUI must be changed when a new implementation of DrawDialog 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?

Reply via email to