function overloading?
Posted: Thu Mar 19, 2009 12:50 pm
Picked up the book "PHP and MySQL Web Development" by Luke Welling and Laura Thomson.
I'm confused..
pg. 147 "Naming your function" -> Many languages do allow you to reuse function names. This feature is called function overloading. However, PHP does not support function overloading, ...
pg. 163 "Constructors" -> PHP supports function overloading, which means that you can provide more than one function with the same name and different numbers or types of parameters.
Ok.. so which is it? Can only constructors be overloaded? I have often overloaded "getters", so does this mean I can't do that? Don't see how PHP can claim to support OO without overloading.
So, what's the real story here?
Thanks in advance.
Ken
I'm confused..
pg. 147 "Naming your function" -> Many languages do allow you to reuse function names. This feature is called function overloading. However, PHP does not support function overloading, ...
pg. 163 "Constructors" -> PHP supports function overloading, which means that you can provide more than one function with the same name and different numbers or types of parameters.
Ok.. so which is it? Can only constructors be overloaded? I have often overloaded "getters", so does this mean I can't do that? Don't see how PHP can claim to support OO without overloading.
So, what's the real story here?
Thanks in advance.
Ken