Re: RFC: Traits for PHP
| From: | Lars Strojny | Date: | Wed, 20 Feb 2008 01:28:53 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35639@lists.php.net to get a copy of this message | ||
Hi,
Am Montag, den 18.02.2008, 20:27 +0100 schrieb php@stefan-marr.de:
[...]
> Thank you for your attention and I'm looking forward to hear your comments
> :)
What about abstract methods in traits? I think this could be handy to
enforce the user class implement a data getter.
trait Foo {
public function doSomething()
{
return str_replace("foo", "bar", $this->_getString());
}
abstract protected _getString();
}
class Consumer
{
use Foo;
protected function _getString()
{
return "foo";
}
}
What do you think?
cu, Lars
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc