title: Fatal error: Declaration of .. must be compatible with .. PHP
body: <p>I'm getting the following error:</p>
  
  <pre><code>Fatal error: Declaration of Shoppingcart::addToCart() must be compatible with that of Ishoppingcart::addToCart() in klassen.php on line 118
  </code></pre>
  
  <p>What could be the problem? I can't find it
  script:</p>
  
  <pre><code>&lt;?php
  // begin
  interface Ishoppingcart{
      public function addToCart();
      public function printOverzicht();
  }
  abstract class Shoppingcart implements Ishoppingcart
  {
      protected $producten = array();
  
      public function addToCart( Product $product) {
          $this-&gt;producten[] = $product;
      }
  }
  class Myshoppingcart extends Shoppingcart {
      public function printOverzicht(){
          echo ("&lt;table border=1&gt;
          &lt;tr&gt;
          &lt;td colspan='7'&gt;Bestellingoverzicht&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td bgcolor=#cccccc&gt; Product ID&lt;/td&gt;
          &lt;td bgcolor=#cccccc&gt; Beschrijving&lt;/td&gt;
          &lt;td bgcolor=#cccccc&gt; Merk&lt;/td&gt;
          &lt;td bgcolor=#cccccc&gt; Model&lt;/td&gt;
          &lt;td bgcolor=#cccccc&gt; Prijs&lt;/td&gt;
          &lt;td bgcolor=#cccccc&gt; Aantal&lt;/td&gt;
          &lt;td bgcolor=#cccccc&gt; Korting&lt;/td&gt;
          &lt;/tr&gt;");
  
          foreach($this-&gt;producten as $product){
              $rij = "";
              $rij .= "&lt;tr&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getID()."&lt;/td&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getBeschrijving()."&lt;/td&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getMerk()."&lt;/td&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getModel()."&lt;/td&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getPrijs()."&lt;/td&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getAantal()."&lt;/td&gt;";
              $rij .= "&lt;td&gt;".$product-&gt;getKorting()."&lt;/td&gt;";
              $rij .= "&lt;/tr&gt;";
              echo ($rij);
          }
          echo ("&lt;/table&gt;");
      }
  }
  class Product {
      private $id;
      private $beschrijving;
      private $merk;
      private $model;
      private $prijs;
      private $aantal;
      private $korting;
  
      function __construct($id,
                          $merk,
                          $model,
                          $prijs,
                          $aantal,
                          $korting){
          $this-&gt;id = $id;
          $this-&gt;beschrijving = $beschrijving;
          $this-&gt;merk = $merk;
          $this-&gt;model = $model;
          $this-&gt;prijs = $prijs;
          $this-&gt;aantal = $aantal;
          $this-&gt;korting = $korting;
          echo ("&lt;br /&gt;Nieuw Product object $beschrijving wordt aangemaakt");
                          }
      public function __destruct(){
          // voer benodigde acties uit
          echo ("&lt;br /&gt;Product object $this-&gt;beschrijving wordt verwijderd");
      }
      // set function
      public function setId($id){
          $this-&gt;id = $id;
      }
      public function setBeschrijving($beschrijving){
          $this-&gt;beschrijving = $beschrijving;
      }
      public function setMerk($merk){
          $this-&gt;merk = $merk;
      }
      public function setModel($model){
          $this-&gt;model = $model;
      }
      public function setPrijs($prijs){
          $this-&gt;prijs = $prijs;
      }
      public function setAantal($aantal){
          $this-&gt;aantal = $aantal;
      }
      public function setKorting($korting){
          $this-&gt;korting = $korting;
      }
      // get function
      public function getId(){
          return $this-&gt;id = $id;
      }
      public function getBeschrijving(){
          return $this-&gt;beschrijving;
      }
      public function getMerk(){
          return $this-&gt;merk;
      }
      public function getModel(){
          return $this-&gt;model;
      }
      public function getPrijs(){
          return $this-&gt;prijs;
      }
      public function getAantal(){
          return $this-&gt;aantal;
      }
      public function getKorting(){
          return $this-&gt;korting;
      }
  
      // printProductInfo
      public function printProductInfo(){
      $rij = "&lt;tr&gt;&lt;td&gt;$this-&gt;id&lt;/td&gt;";
      $rij .= "&lt;td&gt;$this-&gt;beschrijving&lt;/td&gt;";
      $rij .= "&lt;td&gt;$this-&gt;merk&lt;/td&gt;";
      $rij .= "&lt;td&gt;$this-&gt;model&lt;/td&gt;";
      $rij .= "&lt;td&gt;$this-&gt;prijs&lt;/td&gt;";
      $rij .= "&lt;td&gt;$this-&gt;aantal&lt;/td&gt;";
      $rij .= "&lt;td&gt;$this-&gt;korting&lt;/td&gt;";  
      echo ($rij);
      }
  }
  // einde
  ?&gt;
  </code></pre>