Hi,

The subject says it all, really, I need to be able to override a superclass
method AND also call the super's method in a way so that IN the super's
method "$this" will refer to the original object, as follows:

<?php
Class A
{
    function A ()
    {
        // do some stuff...
    }

    function doit ()
    {
        print (get_class ($this));
    }
}

Class B extends A 
{
    function B ()
    {
        // do some more stuff...
    }

    function doit ()
    {
        // This is what I'd like to do...
        $super->doit ();

        print (get_class ($this));
    }
}

$b = new B ();
$b->doit ();
?>

This should print "BB";


Now, in PHP we don't have "$super" to call the superclass' method. Is there
a way around this? Renaming the functions is not an option.
Grateful for any hints.

Cheers,


-Morten
-------------------------------------------------------------------
Rayon Interactive AS             http://www.rayon.no
Morten Lerskau Rønseth           mailto:[EMAIL PROTECTED]
Karenslyst Allé 16d              Tlf.: (47) 2213 5250
0278 Oslo                        Fax : (47) 2213 5260
Norway             

PGP fingerprint: F851 91B6 1D81 1409 8B62  3E14 5A60 65F8 5AF4 56AF


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

Reply via email to