Thread: PHP6 Wishlist
View Single Post
Old 11-29-2007, 06:36 PM   #27 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Id love to see method and constructor overloading like C++ like this:

Code:
class Test
{
    public:
        Test();
        Test(int num1, int num2);
    private:
        int itsNum1;
        int itsNum2;
}
Test::Test()
{
    itsNum1 = 0;
    itsNum2 = 5;
}
Test::Test(int num1, int num2)
{
    itsNum1 = num1;
    itsNum2 = num2;
}
So then we can have 2 types of constructor called.
Its quite a flexible feature in C++ so it would be nice to see it in PHP (not just constructors but functions too) and operator overloading too.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote