Inheritance in codeigniter

#1
[eluser]Aji[/eluser]
I am new to codeigniter. I want to know whether inheritance or polymorphism is used in codeigniter?If yes,can any one explain how it is?

#2
[eluser]richthegeek[/eluser]
Yes, just as it is in all PHP programs.

With regards to inheritance itself, you can extend the controller or model base class (see "Extending Core" in guide) and libraries as well.

For polymorphism, you probably want to create a model that acts as the factory and include the target classes in the same file for creation by the model-extending class.

#3
[eluser]Aji[/eluser]
Thank you for your quick reply richthegeek.
So you said for polymorphism,i have to include the necessary classes in a model,right?

#4
[eluser]richthegeek[/eluser]
You don't have to, but otherwise you'd have to load them by other means (includes etc) which can be a bit of a PITA for no gain.

#5
[eluser]Aji[/eluser]
thank you for your help and hope you will continue in future


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.