Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
abstract class Working
{
abstract protected function where();
abstract protected function why();
abstract protected function how();
public function work()
{
echo $this->where($where);
echo $this->why($reason);
echo $this->how($how);
}
}
class Person extends Working
{
protected function where()
{
return '横浜で';
}
protected function why()
{
return 'お金欲しいから';
}
protected function how()
{
return '営業する';
}
}
$bob = new Person();
$bob->work(); // 横浜でお金欲しいから営業する
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.