note 89678 added to language.oop5.final

From: Date: Thu, 19 Mar 2009 05:54:17 +0000
Subject: note 89678 added to language.oop5.final
Groups: php.notes 
Request: Send a blank email to php-notes+get-152117@lists.php.net to get a copy of this message
Using the scope resolution operator, we can easily access constants, static variables, public functions and final functions from Final Classes Note: even by omitting the "public" keyword from the "nightNews()" method, we can see that the function defaults to public even if prefixed with the keyword final. <?php final class news{ const micCheck = "test1"; // will work static public $promptCheck = "test2"; //will work //will work public function morningNews(){ print 'good morning world!'; } //will work final public function eveningNews(){ print 'good evening world!'; } //will work final function nightNews(){ print 'good night world!'; } } print news::micCheck; // output: test1 print '<br/>'; print news::$promptCheck; // output: test2 print '<br/>'; print news::morningNews(); // output: good morning world! print '<br/>'; print news::eveningNews(); // output: good evening world! print '<br/>'; print news::nightNews(); // output: good night world! ?> ---- Server IP: 216.235.13.26 Probable Submitter: 99.228.250.204 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.final.php Edit -- https://master.php.net/note/edit/89678 Del: integrated -- https://master.php.net/note/delete/89678/integrated Del: useless -- https://master.php.net/note/delete/89678/useless Del: bad code -- https://master.php.net/note/delete/89678/bad+code Del: spam -- https://master.php.net/note/delete/89678/spam Del: non-english -- https://master.php.net/note/delete/89678/non-english Del: in docs -- https://master.php.net/note/delete/89678/in+docs Del: other reasons-- https://master.php.net/note/delete/89678 Reject -- https://master.php.net/note/reject/89678 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152117) next »