[eluser]taewoo[/eluser]
Is there a way to extend the "MY_Controller"?
Meaning this MY_Controller is an abstract class that cannot be extended... then two sub-classes of MY_Controller (say Uno_Controller and Dos_Controller) that actually does "stuff":
Example, in application/library/
Code:
abstract class MY_Controller extends Controller
{
protected $var_1, $var_2;
function __construct($var_1, $var_2)
{
$this->var_1 = $var_1;
$this->var_2 = $var_2;
$this->_authenticate();
}
abstract public function _authenticate();
}
then ALSO in
library, there are two that extend this MY_Controller:
Code:
class Uno extends MY_Controller
{
function __construct()
{
parent::__construct("Hello", "World");
}
public function _authenticate()
{
print_r($this->var_1);
print_r($this->var_2);
}
}
class Dos extends MY_Controller
{
function __construct()
{
parent::__construct("Fart", "Burp");
}
public function _authenticate()
{
var_dump($this->var_1);
var_dump($this->var_2);
}
}
Then in the actual application/controller/XYZ.php, you extend either Dos or Uno.
I can't seem to get this to work.