Final Keyword
Collapse
X
-
Guest repliedThe final keyword is a non-access modifier used for cl***es, attributes and methods, which makes them non-changeable (impossible to inherit or override). The final keyword is useful when you want a variable to always store the same value, like PI (3.14159...). The final keyword is called a "modifier". -
The final keyword prevents child cl***es from overriding a method or constant by prefixing the definition with final . If the cl*** itself is being defined final then it cannot be extended. Note: Properties cannot be declared final: only cl***es, methods, and constants (as of PHP 8.1).Leave a comment:
-
Guest repliedPHP 5 introduces the final keyword, which prevents child cl***es from overriding a method by prefixing the definition with final. If the cl*** itself is being defined final then it cannot be extended.Properties cannot be declared final, only cl***es and methods may be declared as final.Leave a comment:
-
Final Keyword
What is the use of final keyword in PHP???Tags: None
Leave a comment: