title: Calling a parent method from a child class
body: <p>I am having some difficulty with class inheritance. I have 5 classes all of which access my database with create, update and delete methods which I have made abstract so that I can push them into a MasterDatabase class and then have them all extend this class. The problem I am having is with the basic inheritance concept. I have looked through SOF and many people have asked similar questions but not quite this one. </p>
  
  <pre><code>  class DatabaseMaster {
  
      public function  create() {
          $attributes = $this-&gt;attributes();
          $question_marks = array();
          foreach ($attributes as $key =&gt; $value) {
          $question_marks[] = "?";
           }
          $place_holder = array_intersect_key($attributes, get_object_vars($this));
          $place_holder = array_values($place_holder);
          $sql = "INSERT INTO ".self::$table_name." (";
          $sql .= join(", ", array_keys($attributes));
          $sql .= ") VALUES (";
          $sql .= join(", ", array_values($question_marks));
          $sql .= ")";
          $query = $handler-&gt;prepare($sql);
          $query-&gt;execute($place_holder);
     }
  
   }
  </code></pre>
  
  <p>Now if I have a class User. And I wish to this to extend DatabaseMaster, I presume it can't inherit this create function as it is above? My issue is with my reference to $this->attributes in the method for example. The DatabaseMaster has no attributes, but of course my User class does. If I run $user->create(); it doesn't work and I assume its because of this. How does one overcome this problem? I apologise for over using SOF at the moment!</p>
  
  <p>This works....</p>
  
  <pre><code> public function  create() {
      $attributes = $this-&gt;attributes();
      $question_marks = array();
      foreach ($attributes as $key =&gt; $value) {
      $question_marks[] = "?";
      }
      $place_holder = array_intersect_key($attributes, get_object_vars($this));
      $place_holder = array_values($place_holder);
      $sql = "INSERT INTO users (";
      $sql .= join(", ", array_keys($attributes));
      $sql .= ") VALUES (";
      $sql .= join(", ", array_values($question_marks));
      $sql .= ")";
      $query = $handler-&gt;prepare($sql);
      $query-&gt;execute($place_holder);
  }
  </code></pre>
  
  <p>So my question is clearly....how does one make the table name dynamic in the method so that it refers to the child when the child calls it? </p>