Inheritance is a wonderful thing; allowing you to define conceptual layers, or levels within an application, that is, allowing child classes to share traits and attributes of parent classes allows applications to model real-world examples more accurately and intuitively than standard procedural programming.
In CodeIgniter, the default design structure for your application is that the controller you create extends the main CodeIgniter controller. For example, in the following code, we have a Signin
controller, which extends the main CodeIgniter controller, CI_Controller
:
class Signin extends CI_Controller { }
Your Signin
controller will inherit the properties of the CI_Controller
. However, CodeIgniter also allows you to parachute in a stage between the CI_Controller
and the controller you create, you can slot in a middle layer. This middle step is named My_Controller
. The new MY_Controller will extend the CI_Controller (inheriting everything as it goes) and any normal...