ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾PHP ±à³Ì£¾PHP 5 Power programming
Team LiB
Previous Section Next Section

3.16. final Classes

Similar to final methods, you can also define a class as final. Doing so disallows inheriting from this class. The following code does not work:

final class MyBaseClass {
    ...
}

class MyConcreteClass extends MyBaseClass {
    ...
}

MyBaseClass has been declared as final; MyConcreteClass may not extend it and, therefore, execution of the script fails.

    Team LiB
    Previous Section Next Section