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

From: Date: Sun, 24 Dec 2000 14:59:11 +0000
Subject: Re(2): Re: [PHP-WIN] a interesting direction about Class in PHP.
Groups: php.windows 
Request: Send a blank email to php-windows+get-4648@lists.php.net to get a copy of this message
Happy Christmas! Thank, it works on php4.02, but it can not works on php4.0.1. Could you tell me some other undocumented things in php. I really want to know. >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 > > > >-- >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 致 礼! Adam Bear bbbbear@china.com

« previous php.windows (#4648) next »