php题目求解 定义学生类(姓名、学号,年龄),创建对象,存入数组,统计平均...

发布网友 发布时间: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题目求解 定义学生类(姓名、学号,年龄),创建对象,存入数组,统计平均年龄,返回最小年龄姓名

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com