RE: [PHP] I need everyones opinon!

From: Date: Thu, 09 Aug 2001 09:46:27 +0000
Subject: RE: [PHP] I need everyones opinon!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61968@lists.php.net to get a copy of this message
Not sure I fully understand you. I'm assuming that you mean that you prefix each member method with a particular string that relates to the class. By doing this you lose a key strength of OOP. Namely the ability to write polymorphic code. In effect, you would not be able to do the following: class A { function print() { print("A"); } } class B { function print() { print("B"); } } $arrObjects[1]= new A(); $arrObjects[2]= new B(); foreach ($arrObjects as $key->$value) { $value->print(); // This is the polymorphic piece - the object type is decided at run-time } If you methods were called A_print() and B_print() then you would not be able to build generic code as above. -----Original Message----- From: Scott Mebberson [mailto:scott@redbluedesign.com] Sent: 09 August 2001 08:20 To: php-general@lists.php.net Subject: [PHP] I need everyones opinon! Hi Guys, When naming classes and function's within the class(and even functions(probably more so?)) do you use a common string infront of everything? For example HM_function_name() The reason I am asking is because what if you want to easily intergrate a class/function with lots of other classes/function and then you find out there is two with the same name? Any thoughts on this would be good! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#61968) next »