note 54865 added to language.oop5.static

From: Date: Mon, 18 Jul 2005 12:04:14 +0000
Subject: note 54865 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-92109@lists.php.net to get a copy of this message
Just to point it out, this is slightly different from the C++ OO approach. The following code compiles and runs fine using g++ with the options -W -Wall -pedantic :) #include <iostream> struct Foo { static void Bar() { std::cout << "Hi!" << std::endl; } }; int main() { Foo x; x.Bar(); return 0; } Whereas accessing a static method via an instance of a class in PHP doesn't work. It's not a problem, but it's perhaps worth noting, if you're used to C++ OO. ---- Manual Page -- http://www.php.net/manual/en/language.oop5.static.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54865 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54865&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54865&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54865&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54865&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54865&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54865&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54865&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#92109) next »