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();
    }

}
7

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.