O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required