Hi Paul:

On Tue, May 12, 2009 at 12:50:12PM +0100, Paul Biggar wrote:
> 
> This is what I'm getting at. How can the parent class be changed? I
> can see that it might be deferred, but I don't see how it can be
> changed once it's set.

The decision of which class to extend from can be made at run time:

----- main.php -----
<?php
$direction = true;

if ($direction) {
    include './core1.php';
} else {
    include './core2.php';
}

class ext extends core {
}

$o = new ext;
$o->func();
exit;

----- core1.php -----
<?php
class core {
    public function func() {
        echo __FILE__ . "\n";
    }
}

----- core2.php -----
<?php
class core {
    public function func() {
        echo __FILE__ . "\n";
    }
}


--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to