Click to See Complete Forum and Search --> : Polymorphism


Abalfazl
November 16th, 2005, 09:11 AM
Hello firends


From PHP 5 mysql Bible(Page 373) :



"There should be only one constructor function per class definition. Defining more than one such function is syntactically legal, but pointless, as only the definition that occurs last will be in effect. If you’d like to have different constructors to handle different numbers and types of input arguments, "





What is relationship between "different constructors to handle different numbers and types of
input arguments" and "polymorphism"?


Thanks in advance,
GOOD LUCK!

khp
November 17th, 2005, 02:39 PM
I suppose it would be nice if you would explain exactly what you understand polymorphism to be.
If you mean the ability to call different function dependant on the runtime type of an object, not much, having multiple constructors or indeed regular functions with the same name, but different arguments (Number and/or types) is commenly referred to as overloading.