Re: default constructor in Java versus C++
* Gary Labowitz:[color=blue]
> "Alf P. Steinbach" <alfps@start.no > wrote in message
> news:41985c4d.1 151729750@news. individual.net. ..[color=green]
> > * Tony Morris:[color=darkred]
> > >
> > > > I don't think so, Chris. In Java, any constructor that takes no[/color][/color]
> parameters[color=green][color=darkred]
> > > > is called a default constructor.
> > >
> > > This is not true.
> > >[/color][/color][/color]
I didn't write that, Tony did.
Learn to quote, Gary.
[color=blue]
> The JLS says: If a class contains no constructor declarations, then a
> default constructor that takes no parameters is automatically provided:
>
> which is true. But if a class contains constructor declarations, you may
> supply a default constructor that takes no parameters. I believe the use of
> the word "default" means a constructor that takes no parameters, whether it
> is explicit or implicit.[/color]
Nope.
The Java standard's term for an argument-less constructor in general
is "nullary constructor".
A Java default constructor is not the same as a C++ default constructor.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
* Gary Labowitz:[color=blue]
> "Alf P. Steinbach" <alfps@start.no > wrote in message
> news:41985c4d.1 151729750@news. individual.net. ..[color=green]
> > * Tony Morris:[color=darkred]
> > >
> > > > I don't think so, Chris. In Java, any constructor that takes no[/color][/color]
> parameters[color=green][color=darkred]
> > > > is called a default constructor.
> > >
> > > This is not true.
> > >[/color][/color][/color]
I didn't write that, Tony did.
Learn to quote, Gary.
[color=blue]
> The JLS says: If a class contains no constructor declarations, then a
> default constructor that takes no parameters is automatically provided:
>
> which is true. But if a class contains constructor declarations, you may
> supply a default constructor that takes no parameters. I believe the use of
> the word "default" means a constructor that takes no parameters, whether it
> is explicit or implicit.[/color]
Nope.
The Java standard's term for an argument-less constructor in general
is "nullary constructor".
A Java default constructor is not the same as a C++ default constructor.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Comment