no message

This commit is contained in:
a-kizaki
2026-10-06 12:10:09 +09:00
commit 9c2090ffa2
156 changed files with 14850 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
/**
* [Ex03 多態性の利便性 - Inventoryクラスによる消費アイテム管理]
*
* TODO:
* 1. common フォルダ内に、Inventory クラスを作成してください(ファイル名: Inventory.php)。
* - namespace は Common とする。
* - Inventory クラスの仕様:
* プロパティ: private $items (UsableInterface 型のオブジェクトを格納する配列)
* public function addItem(UsableInterface $item): void; // 配列にアイテムを追加する
* public function useAll(): string; // 配列内の各アイテムの useItem() の返り値を改行区切りで連結して返す
* public function getTotalEffect(): int; // 配列内の各アイテムの getAmount() の合計値を返す
*
* 2. 本ファイル内で、require_once を使い以下のファイルを読み込んでください:
* - common/UsableInterface.php
* - common/HealthPotion.php
* - common/ManaPotion.php
* - common/Bomb.php
* - common/Inventory.php
*
* 3. namespace を利用して、Common\Inventory, Common\HealthPotion, Common\ManaPotion, Common\Bomb クラスを使用してください。
*
* 4. Inventory クラスのインスタンスを生成し、以下のアイテムを追加してください:
* - HealthPotion (50)
* - ManaPotion (30)
* - Bomb (40)
* - さらに HealthPotion (20) を追加してもよい。
*
* 5. Inventory の useAll() メソッドを呼び出して、その結果を出力するとともに、
* getTotalEffect() メソッドの返り値(全アイテムの効果値の合計)も出力してください。
*
* ※このファイルには HTML を記述しないこと!
*/