On Thursday, April 11, 2002, at 02:17  PM, Andrey Hristov wrote:

> In PHP the programmer has to call the constructor of the super class.
> The derived class has to know the name of his "super"(java syntax).
> In PHP5 the constructor will have unified name, there will not be a 
> need the derived class to know super class name.

Andrey,

Thank you for the detailed explanation.  So to sum it up, you need to 
call the base class's constructor from within the extended class's 
constructor if you want the effect of both constructors happening at 
once, as the extended class is instantiated into an object.

I've noticed that it -is- possible to call the base class's constructor 
from the script, like this:

// classes are Base and Extended
$instance($arg1) = new Extended;

// directly access the base class's constructor
$instance->Base($arg2);

and it seems to work.  But this is really just shortchanging yourself 
the value of having a constructor in Base, since you are calling it as a 
method and not using its "automaticness" feature.

Thanks again,


Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

Reply via email to