php接口 多态
2010-09-29 16:30 LvSir 阅读(204) 评论(0) 编辑 收藏 举报<?php
interface p1{
public function show();
}
class p1_1 implements p1{
public function show(){
echo "dddd";
}
}
class p1_2 implements p1{
public function show(){
echo "eee";
}
}
class t1 extends p1_1{
public function show(){
echo "ttttttt";
}
}
function show(p1 $obj)
{
$obj->show();
}
$pp1=new p1_1();
$pp2=new p1_2();
show($pp1);
?>
为了实现梦想,无论遇到多么大的困难,都不退缩!