no message
This commit is contained in:
20
Question11-VariousClasses/Ex01.php
Normal file
20
Question11-VariousClasses/Ex01.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Ex01 コンストラクタを使おう]
|
||||
*
|
||||
* TODO:
|
||||
* 1. 新しいファイル "Product.php" を作成し、以下の仕様に従って Product クラスを定義してください。
|
||||
* - クラス名: Product
|
||||
* - プロパティ:
|
||||
* name : 文字列
|
||||
* price : 数値
|
||||
* category : 文字列
|
||||
* - コンストラクタ:
|
||||
* __construct($name, $price, $category) を定義し、上記各プロパティに値をセットしてください。
|
||||
* 2. 本ファイル内で、require_once を使い Product.php を読み込んでください。
|
||||
* 3. 変数 $product を宣言し、Product クラスのインスタンスを生成してください。
|
||||
* 例: new Product("Laptop", 1500, "Electronics")
|
||||
* 4. 最後に、$product の各プロパティ (name, price, category) の値を出力してください。
|
||||
*
|
||||
*/
|
||||
Reference in New Issue
Block a user