Final Methods

class Item {
  private $id = 555;
  final function getID() {
    return $this->id;
  }
}class PriceItem extends Item {
  function getID() {
    return 0;
  }
}
It generates the following error:Fatal error: Cannot override final method item::getid()

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.