note 129694 added to language.oop5.final
| From: | Anonymous | Date: | Thu, 08 Aug 2024 19:14:37 +0000 |
| Subject: | note 129694 added to language.oop5.final | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221466@lists.php.net to get a copy of this message | ||
When desiring a special class structure finalizing magic methods maybe helpful.
<?php
abstract class A {
final public function __construnct(){ echo "A"; }
}
class B extends A {
public function __construct(){ echo "B"; }
}
$b = new B(); // outputs: PHP Fatal error: Cannot override final method a\A::__construct()
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2001:9e8:47a:de00:12ba:893c:e3a5:12ed)
----
Manual Page -- https://php.net/manual/en/language.oop5.final.php
Edit -- https://main.php.net/note/edit/129694
Del: integrated -- https://main.php.net/note/delete/129694/integrated
Del: useless -- https://main.php.net/note/delete/129694/useless
Del: bad code -- https://main.php.net/note/delete/129694/bad+code
Del: spam -- https://main.php.net/note/delete/129694/spam
Del: non-english -- https://main.php.net/note/delete/129694/non-english
Del: in docs -- https://main.php.net/note/delete/129694/in+docs
Del: other reasons-- https://main.php.net/note/delete/129694
Reject -- https://main.php.net/note/reject/129694
Search -- https://main.php.net/manage/user-notes.php