title: Fatal error: Cannot access empty property in, why is it empty?
body: <p>I follow <a href="https://www.youtube.com/watch?v=lNWArvc-uN0&amp;index=12&amp;list=PLfdtiltiRHWF0RicJb20da8nECQ1jFvla" rel="nofollow">this video</a> step by step, but I do seem to have a mistake somewhere. Can anyone explain where my mistake is and how to fix it?</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;?php
  require 'Classes/Calculator.php';
  require 'Classes/OperatorInterface.php';
  require 'Classes/Adder.php';
  require 'Classes/Subtractor.php';
  
  $c = new Calculator;
  
  $c-&gt;setOperation(new Adder);
  $c-&gt;calculate(10, 50);
  
  echo $c-&gt;getResult();
  ?&gt;
  </code></pre>
  
  <p>Calculator.php</p>
  
  <pre><code>&lt;?php
  class Calculator{
  
      protected $result;
  
      protected $operation;
  
      public function setOperation(OperatorInterface $operation){
          $this-&gt;operation = $operation;
      }
  
      public function calculate(){
          foreach(func_get_args() as $number){
              $this-&gt;result = $this-&gt;operation-&gt;run($number, $this-&gt;$result);
          }
      }
  
      public function getResult(){
          return $this-&gt;result;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Adder.php</p>
  
  <pre><code>&lt;?php
  class Adder implements OperatorInterface{
      public function run($number, $result){
          return $result + $number;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>OperatorInterface.php</p>
  
  <pre><code>&lt;?php
  interface OperatorInterface{
      public function run($number, $result);
  }
  ?&gt;
  </code></pre>
  
  <p>I just started learning OOP, so it might be a really stupid mistake, sorry in advance... Thanks for the help!</p>