Overloading:
In Simple words, Same function name but different signature(Parameters)
Ex:
class Maths{
function sum($a, $b) {
$c=$a+$b;
return c;
}
function sum($a, $b, $c) { //PARAMETERS DIFFERS
$d=$a+$b+$c;
return $d;
}
}
Overriding(Polyphormism):
Same Function Name, same signature, different functionality.
Ex:
class Maths{
function sum($a, $b) {
$c=$a+$b;
return c;
}
}
Class Another extends Maths{
function sum($a, $b) {
$c=$a-$b; // FUNCTIONALITY DIFFERS
return c;
}
}
In Simple words, Same function name but different signature(Parameters)
Ex:
class Maths{
function sum($a, $b) {
$c=$a+$b;
return c;
}
function sum($a, $b, $c) { //PARAMETERS DIFFERS
$d=$a+$b+$c;
return $d;
}
}
Overriding(Polyphormism):
Same Function Name, same signature, different functionality.
Ex:
class Maths{
function sum($a, $b) {
$c=$a+$b;
return c;
}
}
Class Another extends Maths{
function sum($a, $b) {
$c=$a-$b; // FUNCTIONALITY DIFFERS
return c;
}
}