Sealing a method in a php class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Areric

    #1

    Sealing a method in a php class

    Hey all,

    Im really starting to get into OO PHP and had a question.

    In PHP4 is there a way to mark a method in a class as non-overridable
    (i.e. sealed or final). From what i understand, by default all methods
    are virtual.

    What about PHP5?

    Thanks

  • Janwillem Borleffs

    #2
    Re: Sealing a method in a php class

    Areric wrote:[color=blue]
    > In PHP4 is there a way to mark a method in a class as non-overridable
    > (i.e. sealed or final). From what i understand, by default all methods
    > are virtual.
    >[/color]

    Indeed, this is not supported by PHP 4;
    [color=blue]
    > What about PHP5?
    >[/color]

    By using the "final" keyword:

    final function Foo() {}


    JW


    Comment

    Working...