Total beginner Object Oriented problem.
Posted: Sat May 22, 2010 6:26 am
I'm beginning object oriented php, and now I'm stuck at this piece of code:
The error is: Fatal error: Call to undefined function calculatesquare() in C:\xampp\htdocs\oo\class_intSquare.php on line 15
What have I done wrong here?
Code: Select all
<?php
class intSquare {
private $squareValue;
private function calculateSquare($val) {
return $val*$val;
}
public function getSquare($value) {
$this->squareValue = calculateSquare($value);
return $this->squareValue;
}
}
$object = new intSquare();
echo $object->getSquare(4);
?>What have I done wrong here?