Score
0
Watch 25 Star 104 Fork 12

Gitee星球的小活动 / 第 0 届 代码编故事接力赛

Join us
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
让我们点燃程序员写作之魂,一人用代码写一段故事玩玩吧~ spread retract

Clone or download
PHP-examination 2.31 KB
Copy Edit Web IDE Raw Blame History
一直丶码下去 authored 2020-03-24 22:16 . add PHP-examination.
<?php
// 对甲乙两名同学所抄试卷,尽量将相同的部分提到父类
// 金庸小说考题试卷
class TestPaper
{
public function TestQuestion1()
{
echo <<<EOF
杨过说过,后来给了郭靖,炼成倚天剑、屠龙刀的玄铁可能是()
A.球磨铸铁
B.马口铁
C.高速合金钢
D.碳素纤维', PHP_EOL;
EOF
, PHP_EOL;
echo '答案 ', $this->answer1(), PHP_EOL;
}
public function TestQuestion2()
{
echo <<<EOF
杨过、程英、陆无双铲除了情花,造成()
A.使这种植物不在害人
B.使一种珍惜物种灭绝
C.破坏了那个生态圈的生态平衡
D.造成该地区沙漠化', PHP_EOL;
EOF
, PHP_EOL;
echo '答案 ', $this->answer2(), PHP_EOL;
}
public function TestQuestion3()
{
echo <<<EOF
蓝凤凰致使华山师徒、桃谷六仙呕吐不止,如果你是大夫,会给他们开什么药()
A.阿司匹林
B.牛黄解毒片
C.氟哌酸
D.让他们喝大量的生牛奶
EOF
, PHP_EOL;
echo '答案 ', $this->answer3(), PHP_EOL;
}
protected function answer1()
{
return '';
}
protected function answer2()
{
return '';
}
protected function answer3()
{
return '';
}
}
// 学生甲抄的试卷
class TestPaperA extends TestPaper
{
protected function answer1()
{
return 'A';
}
protected function answer2()
{
return 'B';
}
protected function answer3()
{
return 'C';
}
}
// 学生乙抄的学生甲抄的试卷
class TestPaperB extends TestPaper
{
protected function answer1()
{
return 'D';
}
protected function answer2()
{
return 'C';
}
protected function answer3()
{
return 'A';
}
}
echo '学生甲抄的试卷: ', PHP_EOL;
$student = new TestPaperA();
$student->TestQuestion1();
$student->TestQuestion2();
$student->TestQuestion3();
echo '====华丽的分隔符====', PHP_EOL;
echo '学生乙抄的试卷: ', PHP_EOL;
$student2 = new TestPaperB();
$student2->TestQuestion1();
$student2->TestQuestion2();
$student2->TestQuestion3();
// 接下来的就看你们的了

Comment ( 0 )

Sign in for post a comment

1
https://gitee.com/Selected-Activities/Code-relay.git
git@gitee.com:Selected-Activities/Code-relay.git
Selected-Activities
Code-relay
第 0 届 代码编故事接力赛
master

Help Search

220309 7019f5b6 1899542 220318 4015cbb9 1899542