Re: Re: [PHP-WIN] a interesting direction about Class in PHP.

From: Date: Fri, 22 Dec 2000 19:29:57 +0000
Subject: Re: Re: [PHP-WIN] a interesting direction about Class in PHP.
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4618@lists.php.net to get a copy of this message
This Works For Me(tm): (4.0.4 module, Apache 1.3.15-dev, NT5 SP1) class elder { function whoami() { echo "I am elder!\n" ; } } class baby extends elder { function whoami() { parent::whoami() ; } } baby::whoami() ; $b = new baby() ; $b->whoami() ; At 16:48 22.12. 2000, Adam Bear wrote the following: -------------------------------------------------------------- > How to use "parent::" to call a parent class? I always get >a "undefined class name 'parent'" error. why? > I know there are many undocumented things in PHP since PHP is >a current developing language. I am very interested to know about >the detail of those. Could you please give me some clue to get it? >Websites,Ebooks or something else would be great appreciated. >¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª > >>BTW, there's even an undocumented way to call a parent class >>without knowing its name: "parent::". >> >> >>At 13:50 19.12. 2000, Adam Bear wrote the following: >>-------------------------------------------------------------- >>>This (static class method calls through classname::methodname) >>>has been in PHP 4 for quite some time. Yes, it's one of MANY >>>(yet) undocumented features, and undocumented features is among >>>the reasons why I'm subscribed to php-windows, php-general, and >>>php-dev, among other things... >>> >>> >>>At 17:16 18.12. 2000, Adam Bear wrote the following: >>>-------------------------------------------------------------- >>>> Maybe I should not post this message in PHP-windowss list, but >>>>I only work on windows and only subscribed this list.so it would >>>>be appreciated if some one repost this message in other list. >>>> Today,when I run the test sample in source code of PHP,I found >>>>a interesting direction to use class method, see the following code: >>>><? class foo { >>>> var $hahaha; >>>> function foo() { >>>> print "I am foo\n"; >>>> } >>>> function bar() { >>>> print "Hey there!\n"; >>>> } >>>> }; >>>> class foo2 extends foo{ >>>> function foo2(){ >>>> print "Het I am in foo2\n"; >>>> } >>>> } >>>> foo::bar() //haha, can't image we can use "::" operator in PHP! >>>> foo2::bar() //even in a descended class can call his father's method. >>>>?> >>>> >>>> This is really true, all code above is tested by me in PHP4.04b and PHP4.0.1, >>>>I think it can work in versions above PHP4. >>>> This direction more like the static method calls in C++,it is very useful in >>>>OO program,we can use a class method directly without create a object instance of >>>>the class. >>>> I search through the documents of PHP but can't find a word about this >>>> operator, >>>>maybe PHP developer term think this operator useless in PHP or maybe this is a >>>>future >>>>feature which will be full supported in the next version of PHP. >>>> I am a chinese so sorry for my pool english. Enjoy youself. >>>> >>>>Sincerely >>>> >>>> Adam Bear >>>> >>>> &&&&&&&&&&&& >>>> \~~~~~~~~/ >>>> ( $ $ ) >>>> { "" } >>>>=======================oOOo----()-----oOOo======== >>>> Wow.... Gold is there! >>>> +-----------------------------------------------+ >>>> | My E-Mail ====> xcbear@netease.com >>>> or bbbbear@china.com >>>> +----------------------------------Oooo-----------+ >>>> oooO ( ) >>>> ( ) ) / >>>> \ ( (_/ >>>> \_) >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>-- >>>>PHP Windows Mailing List (http://www.php.net/) >>>>To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net >>>>For additional commands, e-mail: php-windows-help@lists.php.net >>>>To contact the list administrators, e-mail: php-list-admin@lists.php.net >>>------end of quote------ >>> >>> >>>____________________________________________________________ >>>Cynic: >>> >>>A member of a group of ancient Greek philosophers who taught >>>that virtue constitutes happiness and that self control is >>>the essential part of virtue. >>> >>>cynic@mail.cz >>>ICQ: 2808 2505 >>> >>> >>> >>------end of quote------ >> >> >> >>____________________________________________________________ >>Cynic: >> >>A member of a group of ancient Greek philosophers who taught >>that virtue constitutes happiness and that self control is >>the essential part of virtue. >> >>cynic@mail.cz > > Ö >Àñ£¡ > > Adam Bear > bbbbear@china.com > > >-- >PHP Windows Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net >For additional commands, e-mail: php-windows-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net ------end of quote------ ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.windows (#4618) next »