Get your own PHP server Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<?php
class Fruit {
  final public function intro() {
  }
}
class Strawberry extends Fruit {
  // will result in error
  public function intro() {
  }
}
?>
 
</body>
<!-- /php/phptryit.asp?filename=tryphp_inheritance6 Thu, 06 Feb 2025 19:26:35 GMT -->
</html>
PHP Fatal error: Cannot override final method Fruit::intro() in /home/sdpysj/prog.php on line 15