no message
This commit is contained in:
45
Question13-Inheritance/common/Animal.php
Normal file
45
Question13-Inheritance/common/Animal.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Common;
|
||||
|
||||
class Animal
|
||||
{
|
||||
/** 名前 */
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* 名前をセットするセッター
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 名前を取得するゲッター
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 「{name}は走る」と出力する
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
echo $this->name . 'は走る';
|
||||
}
|
||||
|
||||
/**
|
||||
* 「{name}は呼吸する」と出力する
|
||||
*/
|
||||
public function breathe()
|
||||
{
|
||||
echo $this->name . 'は呼吸する';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user