Files
php-question/Question13-Inheritance/Ex03.php
2026-10-06 12:10:09 +09:00

23 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* [Ex03 オブジェクト指向 - Slimeクラスの利用]
*
* TODO:
* 1. 既に実装済みの "common/Character.php"(namespace inheritance\Common を使用) は変更不要です。
* 2. 新しく "common/Slime.php" を作成し、以下の仕様に従って Slime クラスを定義してください。
* - クラス名: Slime
* - Slime クラスは Common\Character クラスを継承すること。
* - コンストラクタ内で、親クラスのコンストラクタを呼び出し、HP, POWER, ENDURANCE に
* (50, 5, 2) の初期値を設定してください。
*
* 3. 本ファイル内で、require_once を使い "common/Slime.php" を読み込んでください。
*
* 4. namespace を利用して、inheritance\Common\Slime クラスを使用してください。
*
* 5. Common\Slime クラスのインスタンスを生成し、setName() メソッドを使って名前に "スライム" を設定してください。
*
* 6. その後、showParameter() メソッドを呼び出して、キャラクター情報を出力してください。
*
*/