[php classes and objects] Final keyword

不言
Release: 2023-03-24 08:34:02
Original
1528 people have browsed it

This article introduces the [php classes and objects] Final keyword, which has a certain reference value. Now I share it with you. Friends in need can refer to it

Final keyword

Declared as Final:

1.类,不能被继承。 2.方法,不能被子类覆盖。 3.属性,常量,不能被定义为 Final
Copy after login
Example #1 Final 方法示例
Copy after login
Example #2 Final 类示例
Copy after login

Related recommendations:

[php classes and objects] late static binding

[php classes and objects] Type constraints

[php classes and objects] Object copy

The above is the detailed content of [php classes and objects] Final keyword. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!