Final Keyword

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Guest
    Guest replied
    The final keyword is a non-access modifier used for cl***es, attributes and methods, which makes them non-changeable (impossible to inherit or override). The final keyword is useful when you want a variable to always store the same value, like PI (3.14159...). The final keyword is called a "modifier".

    Leave a comment:


  • lisajohn
    replied
    The final keyword prevents child cl***es from overriding a method or constant by prefixing the definition with final . If the cl*** itself is being defined final then it cannot be extended. Note: Properties cannot be declared final: only cl***es, methods, and constants (as of PHP 8.1).

    Leave a comment:


  • Guest
    Guest replied
    PHP 5 introduces the final keyword, which prevents child cl***es from overriding a method by prefixing the definition with final. If the cl*** itself is being defined final then it cannot be extended.Properties cannot be declared final, only cl***es and methods may be declared as final.

    Leave a comment:


  • priya.sharma
    started a topic Final Keyword

    Final Keyword

    What is the use of final keyword in PHP???
Working...
😀
😂
🥰
😘
🤢
😎
😞
😡
👍
👎