Question about super class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Question about super class (/showthread.php?tid=23000) |
Question about super class - El Forum - 09-26-2009 [eluser]shinokada[/eluser] In the system/libraries/Controller.php, it says the following. /* CodeIgniter Application Controller Class * * This class object is the super class that every library in * CodeIgniter will be assigned to. Q1. Does it mean I don't need to load it, if a class is super class? Q2. If I extend Controller in applications/libraries/MY_Controller.php, will it be automatically loaded? Thanks in advance. Question about super class - El Forum - 09-26-2009 [eluser]jedd[/eluser] Hi shinokada and welcome to the CI forums, [quote author="shinokada" date="1253992378"] Q1. Does it mean I don't need to load it, if a class is super class? [/quote] Yes, you don't need to explicitly load it anywhere (ignoring the effect of the parent and extends constructs). Quote:Q2. If I extend Controller in applications/libraries/MY_Controller.php, will it be automatically loaded? MY_Controller - assuming you keep the MY_ prefix as defined in your config - will be looked-for, and loaded automagically. Your Controllers will then need to extend and call MY_Controller as their parent, though, of course. |