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

21 lines
992 B
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
/**
* [Ex02 オブジェクト指向 - Heroクラスの利用]
*
*
* TODO:
* 1. 既に実装済みの "common/Hero.php" および "common/Character.php"(namespace inheritance\Common を使用)
* は変更不要です。これらのファイルは、Hero クラスと Character クラスを定義しています。
* ※Hero クラスは Character クラスを継承し、コンストラクタ内で初期値(HP:25, POWER:10, ENDURANCE:7)を設定しています。
*
* 2. 本ファイル内で、require_once を使い "/common/Hero.php" を読み込んでください。
*
* 3. namespace を利用して、inheritance\common\Common\Hero クラスを使用してください。
*
* 4. Common\Hero クラスのインスタンスを生成し、setName() メソッドを使って名前に "勇者" を設定してください。
*
* 5. その後、showParameter() メソッドを呼び出して、キャラクター情報を出力してください。
*
*/