Note that there are some explanatory texts on larger screens.

plurals
  1. POphp abstract class inheritance error with no abstract method to inherit
    primarykey
    data
    text
    <p>I'm a relative newbie to OOP, and I am getting this error on a learning exercise.</p> <pre><code>Class contains 6 abstract methods and must therefore be declared abstract or implement the remaining methods </code></pre> <p>the error is being thrown from a child class of an abstract class, implementing an interface. I understand that children of an abstract class must implement all abstract methods, but I am not declaring any abstract methods in the parent class or the interface. Shouldn't I only be getting this error if I am not including, in the child class, a declared abstract method from the abstract class or interface?</p> <p>child class:</p> <pre><code>class OuterViewDecorator extends AbstractViewDecorator { const DEFAULT_TEMPLATE = "/var/www/portfolio/simple-php/templates/layout.php"; public function render() { $data["innerview"] = $this-&gt;view-&gt;render(); return $this-&gt;renderTemplate($data); } } </code></pre> <p>parent class:</p> <pre><code>abstract class AbstractViewDecorator implements ViewInterface { const DEFAULT_TEMPLATE = "default.php"; protected $template = self::DEFAULT_TEMPLATE; protected $view; public function __construct(ViewInterface $view) { $this-&gt;view = $view; } public function render() { return $this-&gt;view-&gt;render(); } public function renderTemplate(array $data = array()) { extract($data); ob_start(); $template = include $this-&gt;template; return ob_get_clean($template); } } </code></pre> <p>interface:</p> <pre><code>interface ViewInterface { public function setTemplate($template); public function getTemplate(); public function __set($field, $value); public function __get($field); public function __isset($field); public function __unset($field); public function render(); } </code></pre> <p>thanks for any help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload