Constructors are having a special signature, different from ordinary member functions ?

From: Razvan (mihai11_at_mailcity.com)
Date: 09/30/04


Date: 30 Sep 2004 07:25:17 -0700

Hi !

        Take a look at the following code:

public class CDummy
{
        public static void main(String args[])
        {
                System.out.println("CDummy.");

                CDummy dmy = new CDummy();
        }

        CDummy() {System.out.println("CDummy()");}

        void CDummy() {System.out.println("void CDummy()");}
}

        The constructor "CDummy()" and the member function "void CDummy()"
differ only by the return type. Normally, this is disallowed but since
constructors can only appear after a 'new' operator there is no
ambiguity, so this is allowed !!!

        Well.. no question here. I hope I didn't messed up the explanation:))

Regards,
Razvan