All pastes #420139 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-01 22:08 UTC
rendered paste body
<?php
class 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 {
  var $num3 = $num1 + $num2
  echo "$this->num1 plus $this->num2 equals $this->num3<br />";
  }
  class subCalc extends baseCalc {
    var $num3 = $num1 - $num2
  echo "$this->num1 minus $this->num2 equals $this->num3<br />";
  }
  class mulCalc extends baseCalc {
    var $num3 = $num1 * $num2
  echo "$this->num1 times $this->num2 equals $this->num3<br />";
  }
  class divCalc extends baseCalc {
    var $num3 = $num1 / $num2
  echo "$this->num1 divided by $this->num2 equals $this->num3<br />";
  }
$object1 = new baseCalc();
$object1 -> calculate();
$object2 = new addCalc();
$object2 -> addCalc();

?>