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 -----Original Message----- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 16, 2002 3:31 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Polymorphism question I've also done C and C++ since the 80's. My experience with virtual, is that there is no base implementation for a function. Rather, the function is expected to be defined in the derived class. The inheritance you describe would have a base implementation (no virtual declaration), which could be over-ridden in the derived class. Yes, PHP does have the latter capability. -----Original Message----- From: Richard Fox [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 9:01 AM To: [EMAIL PROTECTED] Subject: [PHP] Polymorphism question 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php