Home>Article>Backend Development> Final journey of this life
First of all, the division of transactions cannot be infinitely refined, so there is definitely no need for infinite subclasses. Once subclasses appear infinitely, it may not bring convenience in solving problems, but infinite consumption of memory resources. Therefore,PHP
provides a termination mechanism so that classes cannot be inherited.
1. Basic syntax:fina
l class class name
2. The final class cannot be inherited
3.final
The keyword not only modifies the class to indicate that the class cannot be inherited, but also modifies the method, indicating that the method cannot be overridden
Summary: The final keyword modification represents the possibility of being unchangeable in variables, represents that it cannot be inherited in classes, and cannot be overridden in methods.
Recommended:php tutorial,php video tutorial
The above is the detailed content of Final journey of this life. For more information, please follow other related articles on the PHP Chinese website!