时间:2021-07-01 10:21:17 帮助过:19人阅读
studywx(studtq); $chperson->usewq(xiaoqiang); $chperson->studywx(studtq); $amperson=new amperson(); $amperson->studywx(studyw); $amperson->usewq(xiaoqiang); $amperson->studywx(qiang); ?>
studywx(); } public function usewq($wq){ $wq->usewq(); } } class chperson extends person{ public function speak(){ echo "中国人在说话,各路让行!~"; } } class amperson extends person{ public function speak(){ echo "美国人在说,叽叽喳喳!~"; } } interface istudy{ public function studywx(); } class studyw implements istudy{ public function studywx(){ echo "如来神掌"; } } class studtq implements istudy{ public function studywx(){ echo "葵花宝典"; } } interface iwq{ public function usewq(); } class jian implements iwq{ public function usewq(){ echo "倚天剑"; } } class qiang implements iwq{ public function usewq(){ echo "洋枪"; } } $chiness=new chperson();//上来个中国人 $chiness->studywx(new studyw()); //给本如来神掌学 $chiness->usewq(new jian());//给他把倚天剑 $american=new amperson();//上来个美国人 $american->studywx(new studtq());//给本葵花宝典学 $american->usewq(new qiang());//给他个破洋枪