1

I know how to call a protected function in a child class. Are there any other methods to call a protected function in a child class besides demonstrated below?

My Parent Calss {

    class myadmin {

        function __construct() {
        }

        protected function _layouts(){
            return "Hello world";                
        }

}

Child Class

class adminpanel extend myadmin {

    public function index() {
        $this->_layouts();
        // or 
        parent::_layouts();
    }

}
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
john
  • 31
  • 1
  • 1
  • 8

0 Answers0