I'm trying to build an abstract class (StatusService) which along with some basic logic defines methods that need to be present in extended classes, but am running into this error that I can't explain:
Fatal error: Abstract function StatusService::upd() cannot contain body in /path/to/lib/services/service.class.php on line 62
Snippet of my base class:
abstract class StatusService {
/** ... */
/**
* @return boolean
* @abstract
*/
abstract public function upd(){}
}
Now I can be completely wrong (haven't written much abstract classes yet), but it doesn't look like it has a body to me..? I would appreciate any pointers to help figure out what I'm doing wrong.
My extended class (just one right now) does define the upd() function and returns a value, but it's still dumping that error on me. In case it matters, this is PHP 5.4.4 running on MAMP Pro.
abstract public function upd(){}
should be
abstract public function upd();
Note that braces.. forms the body of a method.
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