Puzzled Boy
Puzzled Boy

Reputation: 21

What is the meaning of these lines in codeigniter

class Demo extends CI_Controller
{
  function __construct()
  {
    parent::__construct();
  }
}

Upvotes: 0

Views: 2099

Answers (2)

KuKu
KuKu

Reputation: 646

class Demo is extending the CI_Controller.

So all the public properties of CI_Controller can be overridden by class Demo.

function __construct() means that constructor if the class Demo.

In the function __construct(), parent::__construct() means that in the constructor, we are also calling the constructor of the parent class.

Upvotes: 3

Satya
Satya

Reputation: 8881

Demo class's constructor is calling its parent class's constructor which in this case is CI_Controller

Upvotes: 5

Related Questions