class User{ public function __construct($name,$sex,$height){ $this->name=$name; $this->sex=$sex; $this->height=$height; } public function show(){ echo "姓名:".$this->name." 性别:".$this->sex; } } class Book{ public function __construct($author,$prince,$public){ $this->author=$author; $this->prince=$prince; $this->public=$public; } public function show(){ echo "作者:".$this->author." 发布:".$this->public; } } class UserAdmin{ public static function changeName(Book $name){ $name->show(); } } $user = new User("黎明","男","170"); UserAdmin::changeName($user);