[PHP-DEV] Bug #827: request on object constructors From: be <email protected>
Date: 10/06/98

From: be <email protected>
Operating system: any
PHP version: 3.0.5
PHP Bug Type: Feature/Change Request
Bug description: request on object constructors

The constructor method of a class should be changed from
the classes name to "init" or whatever static name - or additional
support for this should be given for backward compatibility.

W H Y ? ?

The current solution makes it impossible to inherit from a class
with constructor method without rewriting the constructor method.

Example:

class origin {
  function origin() {
     # i will initiate all the neccessary things
    ;
  }

class inherit extends origin {
  ;
}

$q = new inherit;

Now nothing is done because inheritance loses the destructor.

In case of a library which lays in the background this is a bad thing.

Documentaion provides some slots of a class to be an api to the user
of that library class. Inheritance is the method of choice to
configure such a class.

Its a bad idea(tm) to force the user of a library to rewrite or wrap the
internals of that library. That makes the idea of a library obsolete.

Boris

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>