<?php
class Rect extends Shape {
private $width = 0;
private $height = 0;
function __construct() {
$this->shapeName = '矩形';
if ($this->validate($_POST["width"], "宽度") & $this->validate($_POST["height"], "高度")) {
$this->width = $_POST["width"];
$this->height = $_POST["height"];
}
}
function area() {
return $this->width * $this->height;
}
function perimoter() {
return 2 * ($this->width + $this->height);
}
}
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!