ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Object Overloading in PHP 5
Subject:   method overloading ala C++/Java
Date:   2005-10-04 08:08:40
From:   trollll
Response to: method overloading ala C++/Java

instead of:
function foo($arg1, $arg2 = null) {
if (!isset($arg2)) {
$arg2 = 42;
}



return $arg1 + $arg2;
}

why not just say:
function foo($arg1, $arg2 = 42) {
return $arg1 + $arg2;
}

other than that, glad to see someone else misses polymorphism. i wish i had the time to add it myself... i haven't checked the game plan on future releases lately - anyone know when and if i can start looking forward to this?