发布网友 发布时间:2022-04-23 02:11
共2个回答
热心网友 时间:2022-04-29 15:50
<?php class Student { private $num, $name,$age,$nationality, $skill;public function getAge() { return $this->age; } public function getName() { return $this->name; }public function setNum($num) {$this->num = $num;}public function setAge($age) {$this->age = $age;}public function setName($name) {$this->name = $name;}public function setNationality($nationality) {$this->nationality = $nationality;}public function setSkill($skill) {$this->skill = $skill;}function toString() { echo 'num:' . $this->num . ' : name:' . $this->name . ' : age:' . $this->age . " : 民族:" . $this->nationality . " : 特长:" . $this->skill; } } $s = new Student(); $s->setNum("123");$s->setName("张三");$s->setAge(24);$s->setNationality("汉族");$s->setSkill("*");$s->toString();?>热心网友 时间:2022-04-29 17:08
php题目求解 定义学生类(姓名、学号,年龄),创建对象,存入数组,统计平均年龄,返回最小年龄姓名