//seal類別
class seal {
//屬性
public $name;
public $shape;
public $diameter;
public $length;
//建構子
function __construct($name,$shape,$diameter,$length) {
$this->name=$name;
$this->shape=$shape;
$this->diameter=$diameter;
$this->length=$length;
}
public function stamp()
{
echo "(印)".$this->name."\n";
}
}
header("Contet-type:text/plain;charset=big5");
//建立實體
$obj=new seal("高島","圓柱",10,60);
//屬性
echo"私的印章的形狀是「".$obj->shape."」\n";
//方法
$obj->stamp();
沒有留言:
張貼留言