Function definitions in child classes override definitions with the
same name in parent classes. In a child class, we can modify the
definition of a function inherited from parent class.
In the follwoing example getPrice and getTitle functions are overriden to retrun some values.
In the follwoing example getPrice and getTitle functions are overriden to retrun some values.
function getPrice(){
echo $this->price . "<br/>";
return $this->price;
}
function getTitle(){
echo $this->title . "<br/>";
return $this->title;
}

No comments:
Post a Comment