Class student { Function __construct(){ Echo “I am a student .<br>”; } Function teacher(){ Echo “I am a teacher .”; } } $peo=new student();
I am a student
I am a student . I am a teacher .
I am a teacher .
无任何输出
//题目有误
<?php
Class student {
Function __construct(){ //这里需要修改才能运行
Echo "I am a student .<br>";
}
Function teacher(){
Echo "I am a teacher .";
$peo = new student();
?>
<?php class test{ function __construct(){ echo "构造函数名以两个下划线开始(__construct)"; } } ?>
Class student { Function __construct(){ Echo "I am a student .<br>"; } Function teacher(){ Echo "I am a teacher ."; } } $peo=new student();
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题