虚函数,实现php
1. virtual-function.php
Parent says $str";
}
}
class ChildClass extends ParentClass {
static public function do_print( $str ) {
echo "Child says $str
";
}
}
class AnotherChildClass extends ParentClass {
static public function do_print( $str ) {
echo "AnotherChild says $str
";
}
}
echo phpversion();
$a=new ChildClass();
$a->say( 'Hello' );
$b=new AnotherChildClass();
$b->say( 'Hello' ); 以上就是虚函数实现php版的内容,更多相关内容请关注PHP中文网(www.php.cn)!
立即学习“PHP免费学习笔记(深入)”;











