What is final class and final method?

It's properties can not be declared final, only classes and methods may be declared as final. If the class or method defined as final then it cannot be extended.

class childClassname extends parentClassname { 
    protected $numPages;

    public function __construct($autor, $pages) {
        $this->_autor = $autor;
        $this->numPages = $pages;

    final public function PageCount() { 
        return $this->numPages; 

Suggest An Answer

No suggestions avaliable!

Latest post from oops interview questions

Ask Question