Section 3.16. final Classes


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.



    PHP 5 Power Programming
    PHP 5 Power Programming
    ISBN: 013147149X
    EAN: 2147483647
    Year: 2003
    Pages: 240

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net