<?php
class Circle extends Shape {
private $radius=0;
function __construct() {
$this->shapeName = '圆形';
if ($this->validate($_POST['radius'], '半径')) {
$this->radius = $_POST['radius'];
}
}
function area() {
return pi() * $this->radius * $this->radius;
}
function perimoter() {
return 2 * pi() * $this->radius;
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号