<?php
class Champions{
public $name;
public $posi;
public function __construct($name, $posi)
{
$this->name = $name;
$this->posi = $posi;
}
public function champInfo(){
print_r($this->name.'은 '.$this->posi.'입니다.');
}
}
$garen = new Champions('가렌','탑');
$garen->champInfo();
echo '<br><br><br>';
$naren = new Champions('나렌','미드');
$naren->champInfo();
class StaticChamp{
public static $champ='다렌';
public static function champInfo($name, $posi){
print_r($name.'은 '.$posi.'입니다.');
}
}
echo'<br><br><br>';
print_r(StaticChamp::$champ);
echo'<br><br><br>';
StaticChamp::champInfo('라렌','바텀');
echo'<br><br><br>';
class Champions2 extends Champions{
public $type;
public function champType(){
print_r($this->name.'은 '.$this->type.'입니다.');
}
}
$garen2 = new Champions2('마렌','서폿');
$garen2->type="전사";
$garen2->champType();
?>