note 129223 added to language.oop5.decon

From: Date: Mon, 05 Feb 2024 12:49:41 +0000
Subject: note 129223 added to language.oop5.decon
Groups: php.notes 
Request: Send a blank email to php-notes+get-221177@lists.php.net to get a copy of this message
A private constructor can NEVER be called. A protected constructor MUST be called explicitely in a child. <?php class Z {private function __construct(){}} class A {protected function __construct(){}} class B extends A {} class C extends A {public function __construct(){parent::__construct();}} // $Z = new Z; // gives fatal error // $A = new A; // gives fatal error // $B = new B; // gives fatal error $C = new C; // works ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 217.100.185.202) ---- Manual Page -- https://php.net/manual/en/language.oop5.decon.php Edit -- https://main.php.net/note/edit/129223 Del: integrated -- https://main.php.net/note/delete/129223/integrated Del: useless -- https://main.php.net/note/delete/129223/useless Del: bad code -- https://main.php.net/note/delete/129223/bad+code Del: spam -- https://main.php.net/note/delete/129223/spam Del: non-english -- https://main.php.net/note/delete/129223/non-english Del: in docs -- https://main.php.net/note/delete/129223/in+docs Del: other reasons-- https://main.php.net/note/delete/129223 Reject -- https://main.php.net/note/reject/129223 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221177) next »