Skip to content

Instantly share code, notes, and snippets.

@jsmitka
Created August 16, 2010 13:41
Show Gist options
  • Save jsmitka/526956 to your computer and use it in GitHub Desktop.
Save jsmitka/526956 to your computer and use it in GitHub Desktop.
<?php
class Hello extends Trait
{
public function greet()
{
echo 'Hello, ' . $this->name . $this->getMark();
}
protected function getFrenchMark()
{
return ' !';
}
}
class Bonjour extends Trait
{
public function salute()
{
echo 'Bonjour, ' . $this->name . $this->getFrenchMark();
}
}
/**
* @use(Hello, Bonjour)
*/
class World extends TraitsObject
{
protected $name = 'World';
protected function getMark()
{
return '!';
}
}
$w = new World();
$w->greet();
echo PHP_EOL;
$w->salute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment