Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36689

Re: "default constructor"

Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!news.glorb.com!newsgate.cuhk.edu.hk!news.netfront.net!.POSTED.217.30.184.161!not-for-mail
From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.java.programmer, comp.lang.c++
Subject Re: "default constructor"
Date Wed, 21 Jun 2017 14:32:27 +0000 (UTC)
Organization Netfront http://www.netfront.net/
Message-ID <oie01p$1gr1$1@adenine.netfront.net> (permalink)
References <default-constructor-20170619023834@ram.dialup.fu-berlin.de>
Injection-Date Wed, 21 Jun 2017 14:32:27 +0000 (UTC)
Injection-Info adenine.netfront.net; posting-host="217.30.184.161"; logging-data="50017"; mail-complaints-to="news@netfront.net"
User-Agent tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (Linux/3.14.79-grbfs-kapsi (x86_64))
Xref csiph.com comp.lang.java.programmer:36689 comp.lang.c++:51497

Cross-posted to 2 groups.

Show key headers only | View raw


In comp.lang.c++ Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>   In C++, it is a constructor that can be called with missing
>   arguments (no arguments).

I have the impression that the word "default" is used in a somewhat
different meaning here.

Rather than meaning the same as "implicit constructor" (which is what
you are referring to), it means "the constructor that's called by
default when there is no explicit constructor call in the code
that instantiates the class" (or, in other words, when the class
is instantiated without any parameters).

In other words, when you write:

  MyClass obj;

the default constructor is called because no other constructor
call was specified explicitly. It doesn't matter whether that
default constructor was implicitly created by the compiler, or
explicitly declared in the implementation of the class.

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: "default constructor" Juha Nieminen <nospam@thanks.invalid> - 2017-06-21 14:32 +0000
  Re: "default constructor" "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2017-06-21 18:07 +0200
    Re: "default constructor" Eric Douglas <e.d.programmer@gmail.com> - 2017-06-21 10:26 -0700

csiph-web