//final修饰的类无法被子类继承
final class human{
}
class man extends human{
}
$m = new man();
//Fatal error: Class man may not inherit from final class (human)
// final修饰的方法无法重写父类的方法
class human{
final function eat(){
echo __METHOD__;
}
}
class man extends human{
function eat(){
echo __METHOD__;;
}
}
$m = new man();
$m->eat();
// atal error: Cannot override final method human::eat()
标签:__,eat,class,面向对象,human,php,final,man From: https://blog.51cto.com/u_14508118/5857803