Adnan
Adnan

Reputation: 589

How to extend My custom library to my controller

I want my Custom_library class extend to My_custom_controller. Is it possible?

Upvotes: 0

Views: 77

Answers (1)

Adrian Modliszewski
Adrian Modliszewski

Reputation: 1124

If you want to extend simply extend:

class xyz extends utv
{
    //class code here
}

But I advise you to load library in constructor to private $var in your controller

class My_custom_controller
{
    private $libs;
    public function __construct()
    {
         $this->libs = new Custom_library();
    }
}

I advise you that becouse you really don't want to extend library in controller, you can override something by accident, that way you will have access to library and you will be shure that nothing wrong goes with your library

Upvotes: 1

Related Questions