private $g; private $r; private $v0; function HandleB($g, $r) { $this->g = $g; $this->r = $r; $this->v0 = sqrt(5 * $this->g * $this->r); } function __destruct() { echo "2:结果是:" . $this->v0 . "<br>"; } } $resultB = new Balance(); $resultB->HandleB(10, 1); /** 一倾斜角为30°的斜面,动摩擦因数u = 0.5; h = 5m;g = 10N/kg;求物体下落到底的速度 */ class energy { private $g; private $h; private $u = 0.5; private $v; function HandleC($h, $g) { $this->g = $g; $this->h = $h; $this->v = sqrt(2 * $this->g * $this->h - $this->u * $this->g * $this->h * 3 / 2); }