no message
This commit is contained in:
23
Question15-Polymorphism/Ex02.php
Normal file
23
Question15-Polymorphism/Ex02.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Ex02 多態性の利便性 - 消費アイテムの一括処理]
|
||||
*
|
||||
* TODO:
|
||||
* 1. 先ほど作成した Common\HealthPotion, Common\ManaPotion, Common\Bomb クラスを利用します。
|
||||
*
|
||||
* 2. 本ファイル内で、require_once を使い以下のファイルを読み込んでください:
|
||||
* - common/UsableInterface.php
|
||||
* - common/HealthPotion.php
|
||||
* - common/ManaPotion.php
|
||||
* - common/Bomb.php
|
||||
*
|
||||
* 3. namespace を利用して、各クラスを使用してください。
|
||||
*
|
||||
* 4. HealthPotion (50), ManaPotion (30), Bomb (40) の各インスタンスを生成し、1つの配列に格納してください。
|
||||
*
|
||||
* 5. 配列内の各アイテムについて、useItem() メソッドを呼び出し、その返り値を表示するとともに、
|
||||
* 各アイテムの getAmount() メソッドを使って効果値を合計し、最終的な合計値も出力してください。
|
||||
*
|
||||
* ※このファイルには HTML を記述しないこと!
|
||||
*/
|
||||
Reference in New Issue
Block a user