All pastes #420160 Raw Edit

Mine

public php v1 · immutable
·published 2007-04-01 22:27 UTC
rendered paste body
<?phpclass baseCalc{  var $num1 = 5;  var $num2 = 6;    function calculate() {    echo "$this->num1 is the first number<br />";    echo "$this->num2 is the second number<br />";    }  }  class addCalc extends baseCalc {    function calculate() {    var $num3 = $num1 + $num2;    echo "$this->num1 plus $this->num2 equals $this->num3<br />";    }  }  class subCalc extends baseCalc {    function calculate() {    var $num3 = $num1 - $num2;    echo "$this->num1 minus $this->num2 equals $this->num3<br />";    }  }  class mulCalc extends baseCalc {    function calculate() {    var $num3 = $num1 * $num2;    echo "$this->num1 times $this->num2 equals $this->num3<br />";    }  }  class divCalc extends baseCalc {    function calculate() {    var $num3 = $num1 / $num2;    echo "$this->num1 divided by $this->num2 equals $this->num3<br />";    }  }$object1 = new baseCalc();$object1 -> calculate();$object2 = new addCalc();$object2 -> calculate();?>