<?php
interface A{
public function test();
}
class B implements A{
public function test(){
echo 'b';
}
}
class C implements A{
public function test(){
echo 'c';
}
}
function show(A $a){
$a->test();
}
show(new C);
?>
//结果:c
实现多态
最新推荐文章于 2023-07-25 01:29:59 发布