All pastes #420187 Raw Edit

Someone

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