0

I try to inherit from an abstract class to an abstract class:

abstract class Android{
    public $description="unknown brand";
    public function __construct() {

    }
    public function get_description(){
        return $this->description;
    }    
    public abstract function cost();
}

abstract class FeaturesDecorator extends Android {
    public abstract function get_description();
}

I get this error:

Fatal error: Cannot make non abstract method Android::get_description() abstract in class FeaturesDecorator in C:\xampp\htdocs\jPlugin\DesignPatterns\Decorator\Decorator.php on line 65

why? what ruins the inheritance?

1 Answer 1

3

The function get_description is already defined and declared in your parent class, you can't make it abstract in the child.

Sign up to request clarification or add additional context in comments.

1 Comment

In other languages you can.. cant it be overriden?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.