> -----Original Message-----
> From: Thomas Watson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 18, 2001 12:35
> To: [EMAIL PROTECTED]
> Subject: [PHP-DEV] More OOP
>
> 1: If you are overriding an existing method in a class, it is then not
> possible to call the original method. Its a very basic thing
> in OOP and
> should be possible. This is allowed in other languages such as C++ and
> Java. In Java this is done by using the super var. (In java
> they also have
> the "this" var. The "super" var. is identical to "this"
> whereas it just
> calls the overridden method).
Sounds a good idea. $super though is identical to $this in plain value but
has a different type.
For $super you mean $this but treated as if it were a parent class. Maybe
this will be introduced soon.
> 2: It would also be great if PHP supported methods with the
> same name but
> with different arguments. I'm not sure if this is possible in
> a language
> such as PHP, because that you don't have to assign a type
> (int, char) to a
> variable (like you do in Java and C/C++ and most other
> compiled languages).
As you indicate it will be difficult to do automatically, however you can do
as perl does and just analyse the arguments yourself and then call a
different internal implementation.
function foo($foo1,$foo2=FALSE) {
if ($foo1 == "oik") return $this->_foo_1($foo1,$foo2);
else return $this->_foo_2($foo1,$foo2,"bink");
}
You can also make use of func_get_args when writing your own dispatcher
(http://www.php.net/manual/en/function.func-get-args.php)
This would me more clear than anything you could hope to get in a type-free
language.
>
> If you like me to explain my questions more in depth then just reply.
>
> /watson
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]