Home >> PHP >> What is final class in PHP

What is final class in PHP

final class:-A final class is a class that is declared with final keyword so that it can never be subclass.
*A final class can not subclass.
*A final class can not be inherited.
*A final class data can not be changed after initialization.
Syntax:-

final class A{
    //body
}
class B extends A{
   //body
}
Output:-
Error because can not inherit of final class

 

Post Your Comment

Next Questions
What is final method
What is final variable
How to print half pyramid using star
How to print half pyramid using number
How to print inverted half pyramid using star
How to print inverted half pyramid using number
How to print half pyramid using one to ten number
How to print pyramid pattern using star
How to print half pyramid pattern using star
How to print half pyramid pattern using star after 180 degree rotation
display errors
string to array
array to string
how to split string into array
How to convert array to string
Difference between exit and die
Set Cookie
Access Cookie
Remove Cookie
how to remove \r\n from string
how to remove new lines from string
how to remove nbsp from string
How to remove all whitespace from a string
How to convert array to string separated by comma
How to list last 12 months from current month

Copyright ©2022 coderraj.com. All Rights Reserved.