Constructors?
Byron Foster <[email protected]> Mon, 04 Oct 2004 01:21:40 -0700
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
I was wonder why it is necessary to call a constructor from within an
exsisting constructor. I found the following to be confusing when
trying to define a default constructor.
public class Test
{
}
new Test()
{
println ("Constructing Test, 123");
this();
}
The above will not compile with the following error:
nice.lang: parsing
foo: parsing
foo: typechecking
~/nice/./foo/Test.nice: line 8, column 3:
Ambiguity for symbol this. Possibilities are :
foo.Test <init>()
foo.Test <init>()
I assume this is occuring because there is an automatic constructor and
the Test() constructor that I have now defined. However, this seems to
be a likely case.
Also, Is it possible to declare a constructor within the class definition?
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl