title: how to call parent class method in php
body: <p>This is the working code, but i want to know without using another object(commented <code>$foo</code>) how could i use <code>printItem()</code> method of <code>class Foo</code> using the <code>$bar</code> object. New to oop programming concept so may be a weak thing to ask but really unable to locate :(</p>
  
  <p>I use scope resolution operator to use <code>printItem()</code> of <code>Foo class</code>, now my query is when we can use this functionality then what is the use of creating objects ? When to use scope resolution operators in proper coding environment.</p>
  
  <pre><code>&lt;?php
  
  class Foo
  {
      public function printItem($string)
      {
          echo "This is in class Foo ". $string ."&lt;br /&gt;";
      }
  
      public function printPHP()
      {
          echo "PHP is great "."&lt;br /&gt;";
      }
  }
  
  class Bar extends Foo
  {
      public function printItem($string)
      {
          echo "This is in class Bar ". $string ."&lt;br /&gt;";
      }
  }       
  
  //$foo = new Foo;
  $bar = new Bar;
  
  $bar-&gt;printPHP();
  $bar-&gt;printItem("Bar class object");
  //Foo::printItem("Mental Case");
  </code></pre>