Extending Core Class
If all you need to do is add some functionality to an existing library - perhaps add a function or two - then it's overkill to replace the entire library with your version. In this case it's better to simply extend the class. Extending a class is nearly identical to replacing a class with a couple exceptions:
The class declaration must extend the parent class.
Your new class name and filename must be prefixed with MY_ (this item is configurable. See below.).
For example, to extend the native Model class you'll create a file named application/core/MY_Model.php, and declare your class with:
class MY_Model extends CI_Model {
}
Note: If you need to use a constructor in your class make sure you extend the parent constructor:
class MY_Model extends CI_Model {
function __construct()
{
parent::__construct();
}
}