Constructors are having a special signature, different from ordinary member functions ?
From: Razvan (mihai11_at_mailcity.com)
Date: 09/30/04
- Next message: Andoni: "[OT] Ultimate Interface."
- Previous message: Babu Kalakrishnan: "Re: Conversion vs cast"
- Next in thread: Tor Iver Wilhelmsen: "Re: Constructors are having a special signature, different from ordinary member functions ?"
- Reply: Tor Iver Wilhelmsen: "Re: Constructors are having a special signature, different from ordinary member functions ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Andoni: "[OT] Ultimate Interface."
- Previous message: Babu Kalakrishnan: "Re: Conversion vs cast"
- Next in thread: Tor Iver Wilhelmsen: "Re: Constructors are having a special signature, different from ordinary member functions ?"
- Reply: Tor Iver Wilhelmsen: "Re: Constructors are having a special signature, different from ordinary member functions ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]