<?php

  class SuperClass {

 var $mySuperClassVar;

 function SuperClass($myVar) {
   $this->mySuperClassVar = $myVar;
   echo "super class var = $myVar<p>";
 }

  }

  class SubClass extends SuperClass {

var $mySubClassVar;

function SubClass($myVar) {
 // super('hello world?')???
 $this->mySubClassVar = $myVar;
 echo "sub class var = $myVar<p>";
}

  }

  $obj =& new SubClass('what is up with your bad self');

?>

hello world
what is up with your bad self

I am interested in finding out if PHP has an equivalent to the Java "super" keyword that evokes methods or constructor of the class' parent class. I can't find anything online on this and hoped maybe one of you guys came up with a nice workaround for this in PHP 4.3.2+ that I could learn. Or point me in the right, open-source, direction for me to figure this out.

Thanx
Phil

    I think your looking for parent. Try this:
    parent.SuperClass('Hello World');

      Ok that was way too easy but I couldn't find that anywhere, the PHP manuals didn't mention it in "java-speak", that I could discern

      Thanx
      Phil

        Write a Reply...