final Methods:
When you want an inheriting class NOT to define the method from its parent class, you will use the final Method.
class parentClass{
function methodA(){
echo “a”;
}
final function methodB(){
echo “b”;
}
}
// Following produces an error as it is trying to define a final method from its parent class
class childClass extends parentClass{
function methodB(){
echo “bbb”;
}
}
final Class:
When you do not want a class to be inherited, then you declare the class to be a final class.