From: Shriramana Sharma <samjnaa@gmail.com>
To: Linux C Programming List <linux-c-programming@vger.kernel.org>
Subject: Re: Syntax of constructor
Date: Mon, 20 Mar 2006 13:47:20 +0530 [thread overview]
Message-ID: <200603201347.20132.samjnaa@gmail.com> (raw)
In-Reply-To: <4f2e7cd30603191934j468334eam34ecca31e49bf649@mail.gmail.com>
Monday, 20 March 2006 09:04 samaye tvayaa likhitam:
> That's called the initializer list. I suggest you get a book that
> explains these things. C++ Primer or The C++ Programming Language
> would be good.
Thanks. I am reading/referring to a PDF copy of Thinking in C++ but of course
without knowing the name of this syntax "initializer list" I cannot search
through the PDF.
Now what I would like to know is: Is
> > CAA2DCoordinate(): X(0), Y(0) {};
much different from:
> > CAA2DCoordinate() { X = 0; Y = 0; }
? Seeing as X and Y are not const-s, I do not see the point in initializing
outside the (empty) braces. If they were const-s, TICP tells me that they
must be initialized before the *start* of the function so the X(0) syntax is
necessary. But here they are not const-s...
--
Tux #395953 resides at http://samvit.org
playing with KDE 3.51 on SUSE Linux 10.0
$ date [] CCE +2006-03-20 W12-1 UTC+0530
next prev parent reply other threads:[~2006-03-20 8:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-20 3:11 Syntax of constructor Shriramana Sharma
2006-03-20 3:34 ` Uday Karan
2006-03-20 8:17 ` Shriramana Sharma [this message]
2006-03-20 13:09 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200603201347.20132.samjnaa@gmail.com \
--to=samjnaa@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.