[geeklog-devel] GL2: abstract classes in PHP?

Chris Franklin chris_s_franklin at yahoo.com
Fri Mar 7 16:01:42 EST 2003

I'm not sure if this would add value to GL2 (i haven't thoroughly reviewed tony's OO code yet) but this is an interesting article on how to implement the notion of abstract classes on php. I could see if being applied to represent the top-level abstract class for something like the item db table.
Anyway, it's basically just a snippet that goes in the constructor:

class Control
    function Control()
     * Do not allow instantiation of Control class.
     * Prevent non subclass from calling constructor.
    if ( !is_subclass_of($this, "Control") ) {
      trigger_error("Control instantiation from non subclass.", E_USER_ERROR);
      return NULL;
  function on() {}         // Turn on a device.
  function off() {}        // Turn off a device.
  function getStatus() {}  // Get the status of a device.

Here's full article:


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist8.pair.net/pipermail/geeklog-devel/attachments/20030307/849207f6/attachment.html>

More information about the geeklog-devel mailing list