I have a class that implements several abstract methods. When I extend that class I get the following fatal error message:
Class CI_Controller_Rest contains 6 abstract methods and must therefore be declared abstract or implement the remaining methods
The class with abstract methods:
class CI_Controller_Rest extends CI_Controller {
public function __construct() {
parent::__construct();
}
abstract public function index();
abstract public function get();
abstract public function head();
abstract public function post();
abstract public function put();
abstract public function delete();
}
The class where I extend CI_Controller_Rest
:
class Welcome extends CI_Controller_Rest {
public function __construct()
{
parent::__construct();
}
public function index() {}
public function get() {}
public function head() {}
public function post() {}
public function put() {}
public function delete() {}
}
What should I do more than this?
If a class has one or more abstract functions, it MUST be declared as an abstract class:
abstract class CI_Controller_Rest extends CI_Controller {
public function __construct() {
parent::__construct();
}
abstract public function index();
abstract public function get();
abstract public function head();
abstract public function post();
abstract public function put();
abstract public function delete();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With