Re: Re: [Zend Engine 2] Re: [PHP-DEV] Re: [ZendEngine 2] RE:[PHP-DEV] oo != php
| From: | Sebastian Bergmann | Date: | Tue, 11 Jun 2002 08:23:29 +0000 |
| Subject: | Re: Re: [Zend Engine 2] Re: [PHP-DEV] Re: [ZendEngine 2] RE:[PHP-DEV] oo != php | ||
| References: | 1 2 3 4 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-85125@lists.php.net to get a copy of this message | ||
Zeev Suraski wrote:
> able to switch aggregated objects after instantiation is not very
> helpful IMHO.
Strategy Design Pattern
<?php
class aStrategy {
// ...
}
class anotherStrategy {
// ...
}
class Foo {
delegatee $strategy;
function setStrategy($strategy) {
$this->strategy = $strategy;
}
}
?>
This way, an object of Foo can dynamically change behaviour in a very
elegant way.
--
Sebastian Bergmann
http://sebastian-bergmann.de/ http://phpOpenTracker.de/
Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/